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

Develop a script that will determine the gross pay for each of three employees.

ID: 3566593 • Letter: D

Question

Develop a script 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're 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 script should input this information for each employee, determine the employees gross pay and output HTML5 text that displays the employees gross pay. Use prompt dialogs to input the data.

Here is what I have. It will prompt for all the information but does not display the results. Any help?

<!DOCTYPE html>

<html>
   <head>
       <meta charset = "utf-8">
       <title>Week 3 DB</title>
       <script>
           var employee1 = " ";
           var employee2 = " ";
           var employee3 = " ";

           var hours1 = 0.0;
           var hours2 = 0.0;
           var hours3 = 0.0;

           var pay1 = 0.0;
           var pay2 = 0.0;
           var pay3 = 0.0;

           var overTime = 0.0;
           var overHours = 0.0;
           var grossPay = 0.0;

           employee1 = window.prompt("Please enter the name of Employee 1");
           employee2 = window.prompt("Please enter the name of Employee 2");
           employee3 = window.prompt("Please enter the name of Employee 3");

           hours1 = window.prompt("Please enter the hours Employee 1 worked");
           hours2 = window.prompt("Please enter the hours Employee 2 worked");
           hours3 = window.prompt("Please enter the hours Employee 3 worked");

           rate1 = window.prompt("Please enter the hourly pay of Employee 1");
           rate1 = window.prompt("Please enter the hourly pay of Employee 2");
           rate1 = window.prompt("Please enter the hourly pay of Employee 3");

           claculatePay(employee1, hours1, pay1);
           claculatePay(employee2, hours2, pay2);
           claculatePay(employee3, hours3, pay3);
          
           {
               if ( hrs > 40 )
               {
                   overHours = hrs - 40;
                   overTime = overHours * rat;
                   grossPay = hrs * rat;
                   grossPay += overHours;
               }
               else
               {
                   grossPay = hrs * rat;
               }

               document.writeln( "<h1>Employee " + emp + " has a gross pay of " + grossPay + "</h1>" );
           }
       </script>

   </head>
       <body>
       </body>
</html>

Explanation / Answer

<html>
<head>
<title>Hours worked for employees</title>
</head>
<body>
<h1>hours worked</h1>
<script type="text/javascript">




var name = prompt( 'Enter Name:', '');
var straightimeworked = 40;
var overtimehours = 10;

var hourlywage = '8.25';
var answer = straightimeworked + overtimehours + hourlywage;



for(var i=0; i<straightimeworked.length; i++) {
num = parseInt( prompt( 'how many of item '+(i+1),'0'));
if(!isNaN(num)) accumulator += items[i]*num;
}
{
num = parseInt( prompt( 'how many regular hours worked this week '+(i+1),'0'));
num = parseInt( prompt( 'how many overtime hours worked this week '+(i+1),'0'));
document.write('Thess pay of employee "answer" is: ' + answer + '<br />');
}
</script>
</body>
</html>