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.
Class
PremiumMember(member_id, name, tier), a subclass of Membertierstripped 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%)Inherited
member_id, name and describe()