please help I was trying to create Class and Object about pay roll but I got stuck when I tried to use another function to complete the computation for my another funtion
I cant think of any idea how can i use the result of hourly rate to compute my overtime pay, to compute my overtime pay it needs the result of hourly rate and multiply them in my overtime hours
employee1 = Employee("001", "Joss Rees", 700, 24, 4, 500, 1)
class Employee:
def __init__(self, employee_number, name, daily_rate, days_worked, overtime_hours, cash_advance, days_absent):
self.employee_number = employee_number
self.name = name
self.daily_rate = daily_rate
self.days_worked = days_worked
self.overtime_hours = overtime_hours
self.cash_advance = cash_advance
self.days_absent = days_absent
def hourly_rate(self):
return print(self.daily_rate / 8)
def monthly_rate(self):
return print(self.daily_rate * self.days_worked)
#heres the problem
def overtime_pay(self):
return self.hourly_rate(self) * self.overtime_hours
source https://stackoverflow.com/questions/70146565/how-to-use-the-result-of-a-function-to-another-function-in-python
Comments
Post a Comment