Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html lang="en>">
- <head>
- <meta charset="utf-8">
- <title>5E part 2 #1</title>
- </head>
- <body>
- <script>
- var q1, q2, q3, n1, n2;
- var n3, d1, d2, d3, t1, t3;
- alert("i can calculate the amount of money you have in change");
- q1 =prompt("enter the amount of quarters you have.");
- q1 = parseFloat(q1)
- n1 = prompt("enter the amount of nickles you have.");
- n1 = parseFloat(n1)
- d1 =prompt("enter the amount of dimes you have.");
- d1 = parseFloat(d1)
- q2 = q1 * 0.25;
- n2 = n1 * 0.05;
- d2 = d1 * 0.10;
- t1 = q2 + n2 + d2;
- q3 = q2.toFixed(2);
- n3 = n2.tofixed(2);
- d3 = n2.toFixed(2);
- t3 = t1.tofixed(2);
- alert("you have $"+ q3 +" in quarters, $"+ d3 +" in dimes and $"+ n3 +" in nickles."+"\n you have $"+ t3 +" in change.");
- </script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement