1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
otez555 [7]
3 years ago
12

Create a web page that uses JavaScript to print a payroll report for a company that has a few employees, all earning the same ho

urly wage: $15 per hour for up to 40 hours per week. If the employee worked more than 40 hours, the hours in excess of 40 are paid at one and a half times this rate.
Computers and Technology
1 answer:
zhenek [66]3 years ago
3 0

Answer:

  1. let employee1 = {
  2.    Name : "Kate",
  3.    Hour : 38,
  4. };
  5. let employee2 = {
  6.    Name : "John",
  7.    Hour : 45,
  8. };
  9. let employee3 = {
  10.    Name : "Catherine",
  11.    Hour : 40,
  12. };
  13. let employeeArr = [employee1, employee2, employee3];
  14. let payrollRef = document.getElementById("payroll");
  15. let output = "";
  16. for(let i = 0; i < employeeArr.length; i++){
  17.    let h = employeeArr[i].Hour;
  18.    let pay;
  19.    if(h <=40){
  20.        pay = h * 15;  
  21.    }else{
  22.        pay = 40 * 15;
  23.        pay += (h - 40) * 15 * 1.5;
  24.    }
  25.    output += "Employee Name: " + employeeArr[i].Name + "<br>";
  26.    output += "Total working hour: " + employeeArr[i].Hour + "<br>";
  27.    output += "Total pay: $" + pay + "<br>";
  28.    output += "<hr>"
  29. }
  30. payrollRef.innerHTML = output;

Explanation:

Presume there is a div element with id "payroll" in a html file. We can write a JavaScript to create a payroll report and place the output to the div.

In JavaScript, let's presume there are only three employees and their names and total working hour are recorded in three objects (Line 1 - 14). Next, we put those employee objects into an array, employeeArr (Line 16).

Next, create a for loop to traverse through each object from employeeArr and calculate the pay based on their working hour (Line 22 - 31).

Next, generate the output string which includes employee name, working hour and total pay (Line 33 -36).

At last,  set the output string as the contents payroll (Line 39).

You might be interested in
Write a JavaScript statement to convert "Information Technology" to uppercase.
OLEGan [10]

Answer:

The JavaScript  statement is

var str1 =    "Information Technology";

var result = str1.toUpperCase();

Explanation:

JavaScript  is used to validate the client side it means it provide the client side validation.

Following are the function of JavaScript that converted the string into uppercase.

 function val()

{

 var str1 = "Information Technology ";

 var result = str1.toUpperCase();

}

The toUpperCase() function convert the string into uppercase in JavaScript

OUTPUT  

INFORMATION TECHNOLOGY

4 0
3 years ago
Explain why a sound background in auto electricity and electronics is absolutely necessary if you are to troubleshoot
Fynjy0 [20]

the electrical system important for starting up your vehicle, but it is also important for keeping your vehicle running as you drive it. In addition, it is the electrical system that is also responsible for the functioning of things such as your headlights, your radio, and your dashboard

4 0
3 years ago
​to add notes or comments, insert a comment tag using the syntax _____.
Aneli [31]
The needed syntax would be:
<!--comment-->
Hope I could be of assistance! ;)
4 0
4 years ago
Read 2 more answers
6.6 Write a function named timesTen. The function should have an integer parameter named number. When timesTen is called, it sho
kondor19780726 [428]

Answer:

   public static void timesTen(int num){

       int numTimesTen = num*10;

       System.out.println("The number "+num +" times 10 is "+numTimesTen);

   }

Explanation:

In the code snippet above which is written in Java programming language, A method (function) is created. The return type is void since this method according to the question will only give an output and not necessarily return a value.

The methods only int parameter is multiplied by 10

Using string concatenation the following output is given

The number 5 times 10 is 50: For an argument of value 5

8 0
3 years ago
What are two reasons why a switch port would have a status of errdisable? (choose two. )
ZanzabumX [31]

The reasons why a switch port would have a status of errdisable include due to duplex mismatch and bad network interface.

<h3>What is a port?</h3>

A port simply means a software defined number associated to a network protocol that's transmits communication.

In this case, the reasons why a switch port would have a status of errdisable include due to duplex mismatch and bad network interface.

Learn more about port on:

brainly.com/question/4804932

#SPJ12

8 0
2 years ago
Other questions:
  • A __________ is the column of data in a database that is used as the basis for arranging data.
    8·2 answers
  • Dennis is driving a car with his family onboard. His children are sitting on the backseat. They have a tablet and want to watch
    13·1 answer
  • The gaining of unauthorized access to data in a<br> system or computer:
    11·1 answer
  • You are asked to optimize a cache design for the given references. Th ere are three direct-mapped cache designs possible, all wi
    7·1 answer
  • If a firm is set to use open-source software with which no one in the IT department is familiar, what should it do? fire the IT
    14·2 answers
  • Along a road lies a odd number of stones placed at intervals of 10 metres. These stones have to be assembled around the middle s
    12·1 answer
  • Explain the impacts of computer in education
    6·2 answers
  • What tool can you use to discover vulnerabilities or dangerous misconfigurations on your systems and network
    5·1 answer
  • Which statement describing the arcade games played in the 1970s is true?
    14·1 answer
  • Define online pollution
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!