A small company pays three kinds of staff every month. Build the family, then run the payroll.
Employee(name, salary) (the parent). salary is per year.
monthly_pay() returns salary / 12, rounded to 2 decimal places.Manager(name, salary, bonus), a child of Employee. bonus is per year.
monthly_pay() returns the employee's monthly pay plus bonus / 12, rounded to 2 decimal places at the end.Intern(name, stipend), a child of Employee. stipend is paid per month.
salary is stipend * 12. Pass that up to the parent's __init__, so the parent's monthly_pay() works for interns without being overridden.Then write two functions:
payroll(staff) returns a dictionary mapping each person's name to their monthly pay. Names are all different. An empty list gives {}.payroll_total(staff) returns everyone's monthly pay added up, rounded to 2 decimal places. An empty list gives 0.