-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathchap4assign.htm
More file actions
38 lines (35 loc) · 1.05 KB
/
chap4assign.htm
File metadata and controls
38 lines (35 loc) · 1.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<!DOCTYPE html>
<html>
<head>
<title>Chapter 4 Assignment</title>
<script type="text/javascript">
function calculate_pay(hours_worked, hourly_pay, tax_rate)
{
var gross_pay = hours_worked * hourly_pay;
var tax_amount = gross_pay * (tax_rate / 100);
var net_pay = gross_pay - tax_amount;
return net_pay;
}
function lb()
{
document.write("<br>");
}
</script>
</head>
<body style="background-color:lightgreen;">
<script type="text/javascript">
var hours_worked = prompt ("Please enter the hours you worked");
var hourly_pay = prompt ("Please enter your hourly pay($)");
var tax_rate = prompt ("Please enter the tax rate(%)");
</script>
<script type="text/javascript">
document.write("<h1><b>Hours Worked: " +hours_worked+ "</b></h1>");
lb();
document.write("<h1><b>Hourly Payrate: $" +hourly_pay+ "</b></h1>");
lb();
document.write("<h1><b>Tax Rate Applied: " +tax_rate+ "%</b></h1>");
lb();
document.write("<h1><b>Net Pay= $" +calculate_pay(hours_worked, hourly_pay, tax_rate).toFixed(2)+ "</b></h1>");
</script>
</body>
</html>