49.3k views
4 votes
An employee’s total weekly pay equals the hourly wage multiplied by the total number of regular hours plus any overtime pay. Overtime pay equals the total overtime hours multiplied by 1.5 times the hourly wage. Write a program that takes as inputs the hourly wage, total regular hours, and total overtime hours and displays an employee’s total weekly pay

1 Answer

4 votes

Answer:

Step-by-step explanation:

Let's do this in python 3. We can calculate the pay for the regular hours and the pay for overtime hours, then sum them up.

def weekly_pay(hourly_wage, total_regular_hours, total_overtime_hours):

regular_hours_pay = hourly_wage*total_regular_hours

overtime_hours_pay = 1.5*hourly_wage*total_overtime_hours

return regular_hours_pay + overtime_hours_pay

User Georges Krinker
by
4.7k points