Still working on projects from pynative.com
Progress so far (17)
TODO.17 Full-Time vs Part-Time Employee Pay Logic
class Employee:
def __init__(self, name):
self.name = name
class FullTimeEmployee(Employee):
def __init__(self, name, salary):
super().__init__(name)
self.salary = salary
monthly_pay = self.salary / 12
print(f"{self.name}'s monthly pay: {monthly_pay}")
class PartTimeEmployee(Employee):
def __init__(self, name, salary, hours):
super().__init__(name)
self.salary = salary
self.hours = hours
monthly_pay = self.salary * self.hours
print(f"{self.name}'s monthly pay: {monthly_pay}")
FullTimeEmployee("Alice", 60000)
PartTimeEmployee("Bob", 500, 20)
Comments
Post a Comment