Write a program that asks the user for their hourly pay and the number of hours
ID: 3759106 • Letter: W
Question
Write a program that asks the user for their hourly pay and the number of hours worked for a week. Determine their gross pay assuming that they make 1.5 overtime pay (i.e. they get overtime, 1.5 times as much per hour for any time worked over 40). Sample output is below from two different runs, with yellow highlights denoting user input: What is your hourly pay: How many hours did you work: 50 You made $550, with 10 hours of overtimeExplanation / Answer
n = int(input("What is your hourly pay: ")) m = int(input("How many hours did you work: ")) if(m>=40): ans = (m-40)*n*1.5+40*n print("You made $"+str(ans)+", with "+str(m-40)+" hours of overtime") else: ans = n*m print("You made $"+str(ans)+" with no overtime")
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.