42 lines
1.5 KiB
HTML
42 lines
1.5 KiB
HTML
<!DOCTYPE html>
|
|
<!--
|
|
Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
|
Click nbfs://nbhost/SystemFileSystem/Templates/ClientSide/html.html to edit this template
|
|
-->
|
|
<html>
|
|
<head>
|
|
<title>Net Pay Calculator</title>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<script>
|
|
var numOfDependants = prompt("Please enter the number of dependants.");
|
|
var grossPay = prompt("Please enter the gross pay: ");
|
|
var hoursWorked = prompt("Please enter the number of hours worked per week: ")
|
|
var netPay;
|
|
|
|
if (numOfDependants == 0) {
|
|
var taxRate = .28;
|
|
} else if (numOfDependants <= 3) {
|
|
var taxRate = .25;
|
|
} else if (numOfDependants <= 6) {
|
|
var taxRate = .15;
|
|
} else if (numOfDependants <= 7) {
|
|
var taxRate = .10;
|
|
}
|
|
|
|
netPay = grossPay - (taxRate * grossPay);
|
|
|
|
if (hoursWorked > 40) {
|
|
netPay *= 1.5;
|
|
}
|
|
var output = "Number of Dependants: " + numOfDependants + "<br>";
|
|
output += "Tax Rate: " + taxRate + "<br>";
|
|
output += "Gross Pay: $" + grossPay + "<br>";
|
|
output += "Net pay: $" + netPay + "<br>";
|
|
|
|
document.write(output);
|
|
|
|
</script>
|
|
</head>
|
|
</html>
|