177k views
1 vote
Write a program that reads in the name and hourly wageof an employee. Then ask how many hours the employee worked in thepast week. Be sure to accept fractional hours. Computethe pay. Any overtime work (over 40 hours per week) is paid at 150percent of the regular wage.

1 Answer

5 votes

Answer:

The program is in python

name=input("enter the name ")#taking input of the name

hourly_wage=float(input("Enter the hourly wage: "))#taking input of the hourly wage

weekly_hours=float(input("Enter how many hours the worker worked in past week: "))#taking input of work done

print()#So that next print will be in new line

payment=0.0

if weekly_hours > 40:

weekly_hours=weekly_hours - 40

payment=(40*(hourly_wage))+(1.5*(hourly_wage*weekly_hours))#calculating payment if weekly_hours are more than 40

else:

payment=weekly_hours*hourly_wage

print(payment)#printing output

Input:-

Adheera

20

48

Output:-

enter the name Enter the hourly wage: Enter how many hours the worker worked in past week:

1040.0

Input:-

Rocky

18

56

Output;-

enter the name Enter the hourly wage: Enter how many hours the worker worked in past week:

1152.0

Step-by-step explanation:

I have taken 3 variables to take input of the name ,hourly wage and weekly hours completed by the worker.If the weekly hours are more than 40 then calculating with addition of bonus else calculating respectively.

Storing the amount to be paid in payment and printing the payment.

User David Losert
by
5.3k points