-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path21_mpg.html
27 lines (25 loc) · 847 Bytes
/
21_mpg.html
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Calculate Miles Per Gallon</title>
<script>
var miles = prompt("Enter miles driven");
miles = parseFloat(miles);
var gallons = prompt("Enter gallons of gas used");
gallons = parseFloat(gallons);
var mpg = miles/gallons;
mpg = parseInt(mpg);
//alert("Miles per gallon = " + mpg);
document.write("<h1>" + "Calculate Miles Per Gallon" + "</h1>");
document.write("<h3>" + "Miles Driving: " + miles + "</h3>")
document.write("<h3>" + "Gallons Used: " + gallons + "</h3>")
document.write("<h3>" + "Miles Per Gallon: " + mpg + "</h3>")
</script>
</head>
<body>
<main>
<h1>Thanks for using the Miles Per Gallon application</h1>
</main>
</body>
</html>