Skip to main content

Checkpoint: Grade Calculator

Challenge on lesson: Checkpoint: Grade Calculator

The Grade Calculator combines every module-2 idea in one small program. Write public static String report(String name, int score) that returns (but does not print!) a line of text: - Start with the name, then ": ", then the score, then " -> ". - Append the letter grade: A for 90+, B for 80–89, C for 70–79, D for 60–69, F below 60. - Also append the percentage as (NN%) — the score itself, so for report("Ada", 93) the exact result is "Ada: 93 -> A (93%)". Everything must be built with final locals where sensible and string concatenation; the grader compares the exact returned String for several students, including boundary scores 90, 60, and 59.

Difficulty: beginner

Back to lesson: Checkpoint: Grade Calculator