Below you will find a payroll that calculates gross pay differently depending on whether the employee worked 40 hours or more. Include another if-else construct that calculates net pay which is 90 of the gross if the gross pay is under $400 or 80 if the gross pay is $400 or more.
You will submit the listing as the assignment.
<html>
<head> <title>A better payroll program </title>
</head>
<body>
<script type="text/javascript">
//A payroll program that take overtime pay into account
var hours, rate;
var gross;
// Read the inputs
rate = parseFloat(prompt("How much do you get paid per hour?", 0.0));
hours = parseFloat(prompt("How much do you get paid per hour?", 0.0));
// If you worked more than 40 hours, you get 150% of your rate for
// everything over 40 hours
if (hours > 40)
gross = rate * 40 + 1.5 * rate * (hours-40);
else
gross = rate * hours;
// Print the answer in an alert box
alert("Your gross pay is $" + gross);
</script>
</body>
</html>