231k views
2 votes
Create a program to calculate the wage. Assume people are paid double time for hours over 60 a week. Therefore they get paid for at most 20 hours overtime at 1.5 times the normal rate. For example, a person working 70 hours with a regular wage of $20 per hour would work at $20 per hour for 40 hours, at 1.5 * $20 for 20 hours of overtime, and 2 * $20 for 10 hours of double time. For the total wage will be:

20 * 40 + 1.5 * 20 * 20 + 2 * 20 * 10 = 1800

The program shall include the following features:

a. Prompt the user to enter the name, regular wage, and how many work he/she has worked for the week.
b. Print the following information:NameRegular wageHours worked in one weekTotal wage of the week

User Kestasx
by
5.4k points

1 Answer

2 votes

Answer:

Written in Python

name = input("Name: ")

wageHours = int(input("Hours: "))

regPay = float(input("Wages: "))

if wageHours >= 60:

->total = (wageHours - 60) * 2 * regPay + 20 * 1.5 * regPay + regPay * 40

else:

->total = wageHours * regPay

print(name)

print(wageHours)

print(regPay)

print(total)

Step-by-step explanation:

The program is self-explanatory.

However,

On line 4, the program checks if wageHours is greater than 60.

If yes, the corresponding wage is calculated.

On line 6, if workHours is not up to 60, the total wages is calculated by multiplying workHours by regPay, since there's no provision for how to calculate total wages for hours less than 60

The required details is printed afterwards

Note that -> represents indentation

User Toothygoose
by
5.3k points