Develop a JavaScript program that will determine the gross pay for each of three employees. The company pays “straight- time” for the first 40 hours worked by each employee and pays “time-and-a-half” for all hours worked in excess of 40 hours. You are given a list of the employees of the company, the number of hours each employee worked last week and the hourly rate of each employee. Your program should input this information for each employee, determine the employee's gross pay and output HTML text that displays the employee's gross pay. Use prompt dialogs to input the data.
What will be an ideal response?
Top:
Determine the gross pay for an arbitrary number of employees
First refinement:
Input information for each employee
Determine the employee’s gross pay
Output the employee’s gross pay
Second refinement:
Input the hours worked for the first employee
While the sentinel value (-1) has not been entered for the hours
Input the employee’s hourly rate
If the hours input is less than or equal to 40
Calculate gross pay by multiplying hours worked by hourly rate
Else
Calculate gross pay by multiplying hours worked above forty by 1.5 times the hourly rate and adding 40 hours
worked by the hourly rate.
Display the employee’s gross pay.
Input the hours worked for thenext employee
Print the average miles/gallon
```
1
2
3
4
5
6