Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

The total wage of an employee in a week depends on the tegular hourly pay mte an

ID: 3681291 • Letter: T

Question

The total wage of an employee in a week depends on the tegular hourly pay mte and the total hours worked in the week. Additionally, any hours worked over 40 hours is counted as overtime, and the overtime hourly pay rate is 1.5 times the regular hourly pay rate. Write a program that allows a user to input a pair of numbers - regular hourly pay mte and the total hours worked in the week for any number of employees. For every entered pair the program mutt display the total wage of that employee for that week Filename The solution for this problem must be coded in a file named two.py Input The is asked the question "Do you want to enter data lor an employee? Answer with y for yes, or any other letter for no: " If the user enters any letter oilier than 'y'. the program finishes. If the user enters 'y'. the loop iterates one more time and lets the user enter data for that employee. In the data entry part for the single employee, the first prompt takes the regular hourly pay rate (float number) and uses the prompt "Enter icgular hourly pay rate: " and the second input (also a float number) takes the total hours worked in the week and must use the prompt 'Enter total hours worked in the week: Output Specification; Following the data entry (regular pay rate and total hours worked in the week - see above) for a single employee, rise loop must print the total week's wage for tliat employee with the dcscriptn c string "Total wage for the week for employee number N = S". uhere N is a countcr (must be an integer 011 each iteration) that starts at I with the fust employee that was processed The value alter the S must be rounded to two digits after the decimal point since it is a money amount

Explanation / Answer

from decimal import getcontext, Decimal


counter = 1
while True:
Join = raw_input('Do you want to enter data for an employee? Answer with y for yes, or any other letter for no: ')
if Join == 'y':
wageRate = float(raw_input('Enter regularly hourly pay rate: '))
hours = float(raw_input('Enter total hours worked in the week: '))
overtimeRate = wageRate * 1.5
pay = min(40, hours) * wageRate # regular hours
pay += max(hours - 40, 0) * overtimeRate # add overtime
result = int(( pay * 100 ) + 0.5) / float(100)
print 'Total wage for the week of the employee number', counter , '= $',result
counter += 1
else :
break

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote