X748: Conditionals Practice 1

Below is some code your co-worker implemented, but they're asking you for help because it's not working the way they want it to.

The code should act in the following way:

  • if value is greater than zero but less than 10, getNumberBack should return 1
  • if value is less than zero, getNumberBack should return 2
  • otherwise, getNumberBack should return 3

Re-write the code below such that the logic is correct. Think about how you might explain what went wrong to your co-worker.

Your Answer:

Reset

Practice a different Java exercise

Feedback

Your feedback will appear here when you check your answer.