In models/employee.py
Define a base class Employee with __init__(self, name, employee_id) that sets name and employee_id attributes.
In models/employee.py
Add two methods to Employee:
- calculate_pay(self) - returns 0 (to be overridden)
- get_info(self) - returns a string: "{name} (ID: {employee_id})"
In models/hourly_employee.py
Create HourlyEmployee that inherits from Employee. Its __init__(self, name, employee_id, hourly_rate, hours_worked) should call the parent constructor and set hourly_rate and hours_worked attributes.
In models/hourly_employee.py
Override HourlyEmployee's calculate_pay(self) method. Return hourly_rate × hours_worked.
In models/salaried_employee.py
Create SalariedEmployee that inherits from Employee. Its __init__(self, name, employee_id, annual_salary) should call the parent constructor and set the annual_salary attribute.
In models/salaried_employee.py
Override SalariedEmployee's calculate_pay(self) method. Return the monthly pay: annual_salary / 12.
In payroll.py
Create a Payroll class with:
- __init__(self, employees) - takes a list of Employee objects
- total_payroll(self) - returns sum of all employee pay
- highest_paid(self) - returns the employee with highest pay
In payroll.py
Add a print_payroll(self) method to Payroll that prints:
Example:
=== Payroll Report ===
Alice Johnson (ID: E001): $2500.00
Bob Smith (ID: E002): $4166.67
Total: $6666.67