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
What is property in educational technology
Maslowich
1. It is based on scientific and technological advancements.
2. It is more a practical discipline and less a theoretical one.
3. It is a fast growing modern discipline.
4. It makes use of the research findings of psychology, sociology, engineering, sciences and social psychology etc., and applies the same to the field of education.
5. It brings pupils, teachers and technical means together in an effective way.
6. It is the science of techniques and methods. It locates the problems in the field of education, remedies them and ultimately aims at improving the education system.
7. It is bound to improve the teacher, the learner and the teaching learning process.
3 0
3 years ago
PLEASE HELP QUICK ASAP NO LINKS PYTHON CODING
Mademuasel [1]

Answer:

its for the movement

Explanation:

6 0
3 years ago
Read 2 more answers
Can some one help sorry I just so confused on this and I keep failing it I just need the help So choose the best answers
statuscvo [17]

Answer:

i7tyerged

Explanation:

7 0
4 years ago
Which of the following correctly declares an array:
AleksandrR [38]

Answer:

a.

Explanation:

6 0
3 years ago
Please please help me
Sholpan [36]

Answer:

increase your browser security settings

8 0
3 years ago
Other questions:
  • In the 2000s, Venezuelan President Hugo Chàvez instituted economic policies that caused smuggling and hoarding of food. What did
    15·1 answer
  • True or false: Sony is the company behind the creation of the ‘Super Mario Bros.' franchise.
    8·2 answers
  • Which file extension indicates a Microsoft Excel document?
    7·1 answer
  • Match these items. 1 . Naturalization Act stated that a foreigner had to live in the United States fourteen years to become a ci
    5·1 answer
  • The distance between Jupiter and the Sun is 5.2 AU. What is the distance in millions of kilometers? (One AU is about 150 million
    8·2 answers
  • It is not important to type '=' before a formula or a function
    12·1 answer
  • You can use _____ to track the state of each user in the application.
    8·1 answer
  • You are creating a program that can add up the amount of money the user spent that day. Right down to the penny! What kind of va
    12·2 answers
  • GUYS I NEED HELP!!!! Every time pc resets it clears all of my data files and content how do you fix this. Pls help
    7·1 answer
  • dion training just installed a new webserver within a screened subnet. you have been asked to open up the port for secure web br
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!