HTMLPayroll Processing program Requirements: A company needs a program to calcul
ID: 3741171 • Letter: H
Question
HTMLPayroll Processing program Requirements: A company needs a program to calculate the gross salary to be paid to their employees each week. The program will receive the department’s names the employee IDs hours worked and salary per hour. A report will be produced with the weekly salary for regular and overtime hours) for each employee. The report will also include a summary section for the department listing the total regulars hours and overtime hours and the corresponding amounts based for those hours.
The requirements for performing the calculations are as follows:
Definitions: Regular hours: hours worked that do not exceed 40 hours. Overtime hours: hours worked above 40 hours. Regular hours salary: Regular hours x hourly salary. Overtime hours salary: Overtime hours x hourly salary x 1.x Total employee salary: Regular hours salary + Overtime hours salary.
You will enter a comment on the head section with your name on it. You will use a text box to get the department’s name.
You will use a text box to get: Employee ID (his/her initials) Hours worked during the week. Hourly salary Each department may have up to 3 employees.
A button will generate a report – which will display on a separate page - including: -The name of the department. -The Regular Salary and -Overtime salary for each employee.
A summary section with: -Department Regular Hours - Department Overtime Hours -Total Department Regular Salaries -Total Department Overtime Salaries -Total Department Salaries
Another button to clear previous entries and reset memory variables. -You will use at least one function for the salaries calculations.
You will use a loop - in conjunction with an array for the salaries calculations.
The report will be produced using the Dynamic Web page creation techniques using document.write statements) practiced during recitations and explained during lectures. The report will produce accurate results whether the department may have ones two or three employees. The variable names should be descriptive
Since the content of a text box - which is what the prompt () functon generates - is going to be used in mathematical operations use the function parseInt() to ensure that the numeric input is treated as numeric data. Syntax example: numericVariable = parseInt numericVariable)
Explanation / Answer
As per the given data
Java script:
<html>
<style>
body,p {
font-family:arial;
font-size:16px;
font-weight:bolder;
}
.container {
width: 500px;
clear: both;
}
.container input {
width: 100%;
clear: both;
}
</style>
<div class="container">
<body>
<h3> Payroll Processing Program </h3>
<br/>Employee's Name
<input type="text" id="emp_name" name="emp_name">
<br>
<br/> Daily Rate
<input type="text" id="daily_rate" name="daily_rate">
<br>
<br/> Number of Days Work
<input type="text" id="no_days_work" name="no_days_work">
<br>
<br>
<button>Get Total Salary</button>
<br><br>
<p id="demo"></p>
<p id="demo2"></p>
</div>
<script>
function salary() {
var emp_name = document.getElementById("emp_name").value;
var daily_rate = document.getElementById("daily_rate").value;
var no_days_work = document.getElementById("no_days_work").value;
gross_pay= parseFloat(daily_rate) * no_days_work;
results = "Employee's Name : " + emp_name + ".";
results2 ="Basic Salary : Php " + gross_pay.toFixed(2)+".";
document.getElementById("demo").innerHTML = results;
document.getElementById("demo2").innerHTML = results2;
}
</script>
</body>
</html>
Note: 3 employees as a input
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.