Skip to main content

Practice · 1 of 4

Boundary contract

CHALLENGE
Difficulty: beginner+25 XP

Implement static bool IsAdult(int age) — true for 18 and above (throws ArgumentOutOfRangeException for negative ages) — and static string Grade(int score) mapping 90+ → "A", 80–89 → "B", 70–79 → "C", 60–69 → "D", below 60 → "F" (each boundary inclusive at the bottom of its band; score outside 0–100 → ArgumentOutOfRangeException).

Back to lesson: Practice: Debugging workout