Skip to main content

Checkpoint: the discount chain

Challenge on lesson: Checkpoint: the discount chain

CHALLENGE
Difficulty: advanced+25 XP

Implement the chain: Customer.pay(int amount) returns the amount. Member extends Customer: pay returns super.pay() minus 5%. Gold extends Member: pay returns super.pay() minus another 5% (so 90% of the original). Use integer arithmetic exactly as written: Member pays amount - amount / 20; Gold pays amount - amount / 10. Implement all three classes and the given pay signatures.

Back to lesson: Checkpoint: the discount chain