X750: Conditionals Practice 3

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 take in an int numbergrade and return a string of the appropriate letter grade.

  • 90 or above should return "A"
  • 89 to 80 should return "B"
  • 79 to 70 should return "C"
  • 69 to 60 should return "D"
  • Anything lower than a 60 should return "F"

What is wrong with the following code? Re-write the code below such that the logic is correct. Think about how you might explain what went wrong to your co-worker and when you might use if and else versus if and else if.

Your Answer:

Reset

Practice a different Java exercise

Feedback

Your feedback will appear here when you check your answer.