Practice · 4 of 4
Player with clamped health
CHALLENGE
Difficulty: beginner+25 XP
Implement nested class Solution.Player: constructor (string name) throws ArgumentException for null/whitespace names; read-only Name; Health starts at 100; TakeDamage(int) and Heal(int) throw ArgumentException for negative amounts, otherwise health stays clamped to [0, 100]; IsAlive is true exactly when Health > 0.
Press Submit to check your solution.
Back to lesson: Practice: Class workout