runtime
265 / 500
question 265 Inheritance & Composition · medium

Premium members extend the discount

Every member gets 5% off orders of 50 or more. Premium members also get a tier bonus on every order: 5 percentage points for gold, 10 for platinum. Write PremiumMember, a subclass of the given Member, that adds a tier (tidied to lower case and validated) and extends discount(total) with super() instead of repeating the base rule.

ClassPremiumMember(member_id, name, tier), a subclass of Member
tierstripped and lower-cased; must be gold or platinum, otherwise ValueError
`discount(total)`the member's discount plus the tier bonus, rounded to 2 places (0.1 is 10%)
Inheritedmember_id, name and describe()

Loading your progress…

Premium members extend the discount — Python practice · Runtime