RunestoneInteractive / RunestoneComponents

Packaging of the Runestone tools for publishing educational materials using github pages
http://runestoneinteractive.org
Other
101 stars 225 forks source link

Answer Check Incorrect #1048

Closed irunestone closed 4 years ago

irunestone commented 4 years ago

Error reported in course Kramer_CS1050_2020_Fall on page topic-1-4-assignment by user chogan9@msudenver.edu chogan9@msudenver.edu 1.4.8 requires an answer of 10, but the correct answer is 11.5.

bhoffman0 commented 4 years ago

Because a and b are int's, a/b is truncated and returned as an int (2 instead of 2.5). Try the code in an active code area or the scratch area (pencil icon at the top right) and you will see that the answer is 10. public class Test1 { public static void main(String[] args) { int a = 5; int b = 2; double c = 3.0; System.out.println(5 + a / b * c - 1); } }