In this assignment you will use a sentinel controlled while loop to determine gross pay for any number of 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. There will not be any deductions for taxes, etc. You are only calculating gross pay.

* Use an alert box to tell the user what your page does
* Use prompt boxes to get user input
* Get the employee name, total hours worked during the period, and "straight time" hourly pay rate
You will receive three user inputs per employee
* Calculate gross pay for each employee
* Display the employee name, total hours worked, and gross pay for each employee
* When all employee data has been entered, display the total gross pay for the period
* Your calculations should handle any number of hours worked for each employee per period (fewer or more than 40)
* Include detailed comments in your script

9 Years
Discussion Span
Last Post by masijade


window.alert("Please follow the prompts to\n determine gross pay for an employee");

var Name,

Name =

window.prompt("Enter the employees name","0");

HoursWorked =

window.prompt("Enter hours worked for pay period","0");

HourlyRate =

window.prompt("Enter hourly pay rate","0");


i know i need a while loop and a flag value, just not sure where exactly.


That is not Java. Java != JavaScript.

If you are to use JavaScript (not Java) then please click on the "Flag Bad Post" on one of these replies and ask the moderators to move this thread to the JavaScript forum.

And, next time, please, pay attention to what you are posting where. The people who post here do not want to waste their time reading a post that does not even belong there.

This article has been dead for over six months. Start a new discussion instead.
Be sure to adhere to our posting rules.