logo CodeStepByStep logo

AgeCheck

Language/Type: Java if/else
Related Links:

The following code has many problems. First, it has a few syntax errors; find and fix them.

Second, it has a logic problem: for some value(s), it prints the wrong answer. Find any logic problems and fix them.

Lastly, the program uses if and else in a clumsy way. Improve the style of the code to be more elegant and avoid redundancy.

Class: Write a complete Java class.

You must log in before you can solve this problem.

Log In

Need help?

Stuck on an exercise? Contact your TA or instructor.

If something seems wrong with our site, please

Is there a problem? Contact us.