Write a program that simulates the printing of a paycheck. Ask the program user
ID: 3750885 • Letter: W
Question
Write a program that simulates the printing of a paycheck. Ask the program user for the name of the employee, the hourly rate, and the number of hours worked. If the number of hours exceed 40, the employee is paid “time and a half”, that is, 150 percent of the hourly rate on the hours exceeding 40. Be sure to use stepwise refinement and break your solution should have several functions. Use the given intName.py file to print the dollar amount of the check. A sample run is shown below. Name your file as check.py Enter the name of the employee: Yogi Bear Enter the hourly pay rate: 50.77 Enter the hours worked: 60 ABC Solutions, 888 First Street, Kamloops. BC, Canada, V2C1K1 Pay Amount is: $3,553.90 Three thousand Five hundred Fifty Three and 90/100 To the order of: Yogi Bear
Explanation / Answer
Here is the sample code:
user = str
end= False
workinghours= round (40,2)
print("This is Chegg Expert! Here's your code below: " )
while end == False:
user = input (" Please enter your name or type 'o' to exit : ")
if user == "0":
print("End of process") break
else:
wage=(float(input(" How much do you earn or make per hour : ? ",) ))
if workinghours<=40:
print ("Employee Name: ", user)
print("Overtime hours: 0")
print("Overtime pay: $0.00")
regularpay=round(workinghours * wage , 2)
print("Gross pay: ", regularpay)
elif workinghours> 40:
overtimehours=round(workinghours - 40.00,2)
print("Overtime hours: " overtimehours)
print("Employee name: ", user)
regularpay=round(workinghours * wage ,2)
overtimerate=round(wage *1.5,2)
overtimepay=round(overtimehours * overtimerate)
grosspay = round(regularpay + overtimepay , 2)
print("Regular pay: ", $(:0, .2f}.format(regularpay))
print("Overtime pay: ", $(:0, .2f}.format(overtimepay))
print("Gross pay: ", $(:0, .2f}.format(grosspay))
Hope this solution of mine works for you....feel free to revert if you need any more assistance on this. :) Happy Coding!
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.