THINK FIRST·CODE LATER

← All labs

Letter grade with validation

Problem

Write a class Grade that reads a score (an int) and prints the letter grade:

Score Grade
90–100 A
80–89 B
70–79 C
60–69 D
0–59 F

Print it as Grade: B. If the score is below 0 or above 100, print Invalid score instead.

Write it here or in your IDE, then paste it. Compile and test it yourself before comparing. Your code stays in your browser — it is never sent to or stored on the server.