Recap - Employee Hierarchy
Part of the Object Oriented Programming section of Coddy's Python journey — lesson 22 of 64.
Challenge
HardIn this challenge, you'll implement an employee hierarchy system.
You'll need to complete the following files:
person.py: Implement the basePersonclass with name, age, and introduction methodemployee.py: CreateEmployeeclass inheriting fromPersonwith employee_id and salarymanager.py: ImplementManagerclass extendingEmployeewith department managementengineer.py: BuildEngineerclass extendingEmployeewith programming skillstechnical_manager.py: CreateTechnicalManagerusing multiple inheritancehierarchy_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
1Fundamentals of OOP
External FilesIntroduction to OOPClasses vs ObjectsThe self ParameterMethodsAttributesConstructor Method (__init__)Recap - Simple Calculator4Inheritance
Basic InheritanceThe super() FunctionMethod OverridingMultiple InheritanceMethod Resolution OrderRecap - Employee Hierarchy7Special Methods
Magic Methods IntroductionOperator OverloadingContainer Magic MethodsRecap - Custom List10Design Patterns Part 1
Intro to design patternSingleton PatternFactory PatternObserver PatternStrategy Pattern2Decorators
Introduction to DecoratorsProperty DecoratorStatic Method DecoratorClass Method Decorator5Polymorphism
Method Overriding RevisitedDuck TypingAbstract Classes and MethodsInterface DesignRecap - Shape Calculator8Advanced OOP Concepts
Composition vs InheritanceMixinsStatic and Class MethodsClass DecoratorsContext Managers3Class Properties
Instance vs Class VariablesProperty DecoratorsPrivate AttributesRecap - Bank Account Manager6Encapsulation
Public, Protected, Private MemAccess ModifiersInformation HidingProperty Decorators AdvancedRecap - Student Records System12Project: Library Management
Project OverviewBook and User Classes