Menu
Coddy logo textTech

Recap - Employee Hierarchy

Part of the Object Oriented Programming section of Coddy's Python journey — lesson 22 of 64.

challenge icon

Challenge

Hard

In this challenge, you'll implement an employee hierarchy system.

You'll need to complete the following files:

  • person.py: Implement the base Person class with name, age, and introduction method
  • employee.py: Create Employee class inheriting from Person with employee_id and salary
  • manager.py: Implement Manager class extending Employee with department management
  • engineer.py: Build Engineer class extending Employee with programming skills
  • technical_manager.py: Create TechnicalManager using multiple inheritance
  • hierarchy_utils.py: Implement utility function to display class hierarchies

Each file contains detailed TODO comments guiding you through the implementation.

Try it yourself

from person import Person
from employee import Employee
from manager import Manager
from engineer import Engineer
from technical_manager import TechnicalManager
from hierarchy_utils import show_hierarchy

# Test your implementation - DO NOT MODIFY THIS TEST CODE
# Create instances
person = Person("John Smith", 30)
employee = Employee("Alice Johnson", 35, "E12345", 60000)
manager = Manager("Bob Williams", 45, "M54321", 85000, "Marketing")
engineer = Engineer("Carol Davis", 28, "E98765", 75000, "Python")
tech_mgr = TechnicalManager("Dave Wilson", 40, "TM24680", 90000, "R&D", "Java")

# Test basic methods
print(person.introduce())
print(employee.introduce())
print(f"Monthly pay: ${employee.calculate_paycheck():.2f}")
print(manager.manage_team())
print(engineer.code())

# Test inheritance hierarchies
print("\nHierarchy demonstrations:")
show_hierarchy(TechnicalManager)

# Test method resolution in multiple inheritance
print("\nTechnical Manager tests:")
print(tech_mgr.introduce())
print(f"Monthly pay: ${tech_mgr.calculate_paycheck():.2f}")
print(tech_mgr.manage_team())
print(tech_mgr.code())

All lessons in Object Oriented Programming