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

83717

ID: 3651785 • Letter: 8

Question

// Program name: payrollCalc.html // Purpose: Get payroll information, calculate // deductions, display all information // Author: Kenneth Bowden // Date last modified: 24-Sep-2012 // Declare variables var firstName; // employee's first name var lastName; // employee's last name var fullName; // employee's full name var grossPay; // gross pay var netPay; // net pay var hoursWorked; // hours worked var wageRate; // wage rate var fedTaxWith; // federal withholding var stateTaxWith; // state withholding var countyTaxWith; // county withholding var medInsDed; // medical ins deduction var totDeductions; // total deductions // Declare constants (withholding rates) var FED_RATE = 0.15; // federal rate var STATE_RATE = 0.034; // state rate var COUNT_RATE = 0.011; // county rate // Declare constants (display) var BR = "
"; // HTML line break var PA = "

"; // HTML paragraph break var ES = ""; // empty string // Program heading document.write("Employee Payroll Calculator" + PA) // Get employee's name, hours worked, and wage rate lastName = prompt("Enter the employee's last name:",ES); firstName = prompt("Enter the employee's first name:",ES); hoursWorked = prompt ("Enter the number of hours worked:",ES); hoursWorked = parseFloat(hoursWorked); wageRate = prompt("Enter the employee's hourly wage:",ES); wageRate = parseFloat(wageRate); // Calculate gross pay grossPay = hoursWorked * wageRate; alert("hey"); // Calculate federal, state, and county withholding fedTaxWith = grossPay * FED_RATE; alert("hey2"); stateTaxWith = grossPay * STATE_RATE; alert("hey3"); countyTaxWith = grossPay * COUNT_RATE; alert("hey4"); // Get medical insurance deduction medInsDed = prompt("Enter medical insurance deduction:",ES); medInsDed = parseFloat(medInsDed); // Calculate total deductions and net pay totalDeductions = fedTaxWith + stateTaxWith + countyTaxWith + medInsDed; netPay = grossPay - totDeductions; // Concatenate first and last name fullName = firstName + " " + lastName; // Display all information document.write("payroll information for: " + fullName + BR); document.write("Hours worked: " + hoursWorked + BR); document.write("Horuly wage rate: $" + wageRate.toFixed(2) + BR); document.write("Gross pay: $" + grossPay.toFixed(2) + BR); document.write("Withholdings:" + BR); document.write("Federal income tax: $" + fedTaxWith.toFixed(2) + BR); document.write("State income tax: $" + stateTaxWith.toFixed(2) + BR); document.write("County income tax: $" + countyTaxWith.toFixed(2) + BR); document.write("Medical insurance: $" + medInsDed.toFixed(2) + BR); document.write("Total deductions: $" + totDeductions.toFixed(2) + BR); document.write("Net pay: $" + netPay.toFixed(2) + PA); // End the program document.write("End of program. Good-bye!" + BR);

Explanation / Answer

97608aa6c24f40cc0d458d9d0041e819ecce6f156dcae41e47f49ccff90690f8

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote