thisThis is a calculator I'm working on. The ultimate goal is to calculate multiple payrolls before selecting to end the program, please review current version in that context. PSA: I'm a beginner.
def main():
hours, rate = inputData()
normal_hours, overtime_hours, overtime = computePay (hours,rate)
regular, total_pay = preovertime_hours (hours, rate, overtime)
displayPay (rate, normal_hours, overtime_hours, regular, overtime, total_pay)
def inputData():
name = raw_input('Name of employee: ')
hours = float (input('Now enter the hours worked please:'))
rate = float (input('Now enter the pay rate:'))
return hours, rate
def computePay (hours,rate):
if hours < 40:
normal_hours = hours
overtime_hours = 0
else:
normal_hours = 40
overtime_hours = hours - 40
if hours > 40:
overtimerate = 1.5 * rate
overtime = (hours-40) * overtimerate
else:
overtime = 0
return normal_hours, overtime_hours, overtime
def preovertime_hours (hours, rate, overtime):
regular = hours * rate
total_pay = regular
return regular, total_pay
def displayPay (rate, normal_hours, overtime_hours, regular, overtime, total_pay):
print ("The amount to be paid to in this pay period is $" + format(total_pay, '.2f'))
main()