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: 3566592 • 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.

Explanation / Answer

<html>
   <body>
       <form>
       Employee Name: <input type="text"><br>
       No of Hours worked: <input type="text" name="sal"><br>
       <input type="submit">Submit  
       </form>
       <p id="grossPay"></p>
   <script>
       function employeeGrossPay() {
            var grossPay1;
           var hour=3000;
           var noOfHours=sal;
           if(noOfHours<40){
               grossPay=noOfHours*hour;
           }
           else
               grossPay=noOfHours*3500;
           return grossPay;
       }
       document.getElementById("grossPay").innerHTML = employeeGrossPay();
   </script>
      
   </body>
</html>