Answer:
class Employee:
def __init__(self, first_name, last_name, id_number):
self.first_name = first_name
self.last_name = last_name
self.id_number = id_number
def calculate_payroll(self):
pass
class SalaryEmployee(Employee):
def __init__(self, first_name, last_name, id_number, monthly_salary):
super().__init__(first_name, last_name, id_number)
self.monthly_salary = monthly_salary
def calculate_payroll(self):
return self.monthly_salary
class PartTimeFaculty(Employee):
def __init__(self, first_name, last_name, id_number, credit_units):
super().__init__(first_name, last_name, id_number)
self.credit_units = credit_units
def calculate_payroll(self):
return self.credit_units * 1000
class HourlyEmployee(Employee):
def __init__(self, first_name, last_name, id_number, hourly_rate, hours_worked):
super().__init__(first_name, last_name, id_number)
self.hourly_rate = hourly_rate
self.hours_worked = hours_worked
def calculate_payroll(self):
return self.hourly_rate * self.hours_worked
def main():
employees = [] # List to hold employee objects
# Load payroll database from file (payroll.txt)
while True:
print("Welcome to the Saddleback College Employee Payroll System.")
print("Menu:")
print("(1) List All Employees")
print("(2) Add a New Employee")
print("(3) Remove an Existing Employee")
print("(4) Display Info on an Employee")
print("(5) Calculate Monthly Payroll")
print("(6) Save Database")
print("(7) Exit")
choice = int(input("Choose an option: "))
if choice == 1:
# List all employees
pass
elif choice == 2:
# Add a new employee
pass
elif choice == 3:
# Remove an existing employee
pass
elif choice == 4:
# Display info on an employee
pass
elif choice == 5:
# Calculate monthly payroll
pass
elif choice == 6:
# Save database to file (payroll.txt)
pass
elif choice == 7:
# Exit the program
break
else:
print("Invalid choice. Please select a valid option.")
if __name__ == "__main__":
main()