Skip to content
C

Employee and Manager (Inheritance + Overriding)

Easypython

Create an Employee class with a method calculatebonus() returning a fixed amount, and a Manager subclass that overrides calculatebonus() to return a higher amount.

What the problem means: two related but distinct "kinds" of thing (a regular employee and a manager) share most of their structure but differ in one specific calculation — a textbook use case for inheritance and method overriding.

Approach: Employee.calculatebonus() returns 1000. class Manager(Employee): redefines calculatebonus() to return 5000, completely replacing the parent's version for Manager objects.

Input: No input.

Output: Two lines: the Employee's bonus, then the Manager's bonus.

Input (stdin)

Output

Run your code to see output here...