Skip to main content

Practice · 2 of 4

Payroll with base reuse

CHALLENGE
Difficulty: beginner+25 XP

Implement nested classes in Solution: abstract Employee with protected Name, public constructor validating non-blank name (else ArgumentException), read-only Name, public abstract decimal MonthlyPay();; Salaried(decimal monthly) overriding MonthlyPay() to return the salary; Hourly(decimal rate, int hours) overriding to return rate * hours.

Back to lesson: Practice: OOP workout