Advertisement
476179

5.3.2Act3

Oct 23rd, 2018
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.93 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html lang="en>">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>5E part 2 #1</title>
  6. </head>
  7.  
  8. <body>
  9. <script>
  10.  
  11.  
  12. var q1, q2, q3, n1, n2;
  13. var n3, d1, d2, d3, t1, t3;
  14.  
  15.  
  16. alert("i can calculate the amount of money you have in change");
  17.  
  18. q1 =prompt("enter the amount of quarters you have.");
  19. q1 = parseFloat(q1)
  20.  
  21. n1 = prompt("enter the amount of nickles you have.");
  22. n1 = parseFloat(n1)
  23.  
  24. d1 =prompt("enter the amount of dimes you have.");
  25. d1 = parseFloat(d1)
  26.  
  27. q2 = q1 * 0.25;
  28. n2 = n1 * 0.05;
  29. d2 = d1 * 0.10;
  30.  
  31. t1 = q2 + n2 + d2;
  32.  
  33. q3 = q2.toFixed(2);
  34. n3 = n2.tofixed(2);
  35. d3 = n2.toFixed(2);
  36. t3 = t1.tofixed(2);
  37.  
  38.  
  39. alert("you have $"+ q3 +" in quarters, $"+ d3 +" in dimes and $"+ n3 +" in nickles."+"\n you have $"+ t3 +" in change.");
  40.  
  41.  
  42.  
  43.  
  44. </script>
  45. </body>
  46.  
  47. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement