An employee's total weekly pay is calculated by multiplying the hourly wage and number of regular hours plus any overtime pays which in turn is calculated as 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 prints an employee's total weekly pay.

Respuesta :

Answer and Explanation:

Using Javascript:

Function TotalWeeklyPay(rate,hours,overtimeHours)

{

var total = rate*hours+overtimeHours*1.5*rate;

return total;

}

TotalWeeklyPay();

In order to take input of hourly wage, total regular hours, and total overtime hours, we make them our parameters in the function TotalWeeklyPay() and then use them to calculate total weekly pay in our function. We call the function TotalWeeklyPay() after definition.

ACCESS MORE