Ok I need help with this program. Here is the assignment
Write a payroll program that pays time and a half for anything over 40 hours. This should have 3 functions in addition to main.
- The first function asks the user how many total hours were worked and the pay rate and returns this information to main. These values must be validated. Hours worked must be at least 8 and no more than 86. Pay rate cannot be less than $7.00 or more than $50.00.
- The second function calculates the regular hours and overtime hours and returns this information to main. A person might work less than 40 hours so you must allow for that situation.
- The third function calculates the regular pay, (regular hours times pay rate); overtime pay, (overtime hours times overtime pay rate) and the total pay and returns this information to main.
- Main will then display this information on the screen like the sample below. (Values will have to be passed and returned).
The output should look something like the following:
Payroll Information
Pay rate $10.00
Regular Hours 40
Overtime Hours 20
Regular pay $400.00
Overtime pay $300.00
Total Pay $700.00
And Here is what I have so far
def work_info():
hw = input('Enter the amount of hours worked between 8 and 56')
while hw < 8 or hw > 86:
print('Enter the amount of hours in range')
pr = input('Enter the your current payrate between $7 and $50')
while pr < 7 or pr > 50:
print('Enter a payrate in range')
def reg_ovt_hours():
if hw < 40:
reg_hours = hw and ovt_hours = 0
else reg_hours > 40
ovt_hours = hw - 40
return hw
def reg_pay():
reg_pay = reg_hours * pr
ovt_pay = ovt_hours * reg_pay * 1.5
tot_pay = reg_pay + ovt_pay
return pr, reg_hours, ovt_hours
def main():
print('Payroll Information')
print ('Pay rate') pr
print reg_hours
print ovt_hours
print reg_pay
print ovt_pay
print tot_pay
main()
Please let me know how I can get this to work right