Seems like some of these generated problems are unsolvable.
Also, there’s no type checks for the…so when the prompt has specific types using char/String, int/Integer, int/short/byte, double/Double are equivalent.
The problem is simple, there are 4 variables and one of them has the wrong value…sometimes two are changed but only 1 line is allowed to change. Even stacking statements shows a checkstyle error. I pasted the problem below as well as a screenshot…
Debugging Challenge: Practice with Primitive Types
Write a snippet of code—not a function—that:
- declares a variable
count
of typeint
and initializes it to88
- declares a variable named
temperature
of typedouble
and initializes it to14.3
- declares a variable
letter
of typechar
and initializes it toX
- declares a variable named
isCSAwesome
of typeboolean
and initializes it totrue
Instructions
The code below is incorrect. You must fix it without modifying more than 1 line.
You have modified 1 line.
int count = 88;
double temperature = 13.3;
char letter = 88; if (count == 88) temperature = 14.3;
boolean isCSAwesome = true;
Your code passed all the tests! Splendiferously done!
But we noticed a few things you could improve...
Your submission has checkstyle errors:
Question.java:3: checkstyle error: 'if' construct must use '{}'s.
Question.java:3: checkstyle error: Only one statement per line allowed.
2 errors