Advertisement
Guest User

Untitled

a guest
Jun 25th, 2017
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.43 KB | None | 0 0
  1. <html>
  2. <head>
  3. <title> Javascript Assignment 3: Chris Gorman
  4. </title>
  5. <h1> Gorman's Sports Agency-eCommerce </h1>
  6. </head>
  7. <body>
  8. <table bgcolor="red" border="1">
  9. <tr><td><h3>Service</h3></td><td><h3>Price</h3></td><td><h3>Discount</h3></td></tr>
  10. <tr><td>Contract Negotiation</td><td>$200</td><td>.05</td></tr>
  11. <tr><td>Legal Counseling</td><td>$350</td><td>.07</td></tr>
  12. <tr><td>Contract Extensions</td><td>$125</td><td>.02</td></tr>
  13. <tr><td>Career Marketing</td><td>$400</td><td>.10</td></tr>
  14. </table>
  15. <script type="text/javascript">
  16. /*
  17. Chris Gorman, Rohit, Javascript 3, November 4
  18. */
  19.  
  20. var orderagain;
  21. var order_confirm;
  22. var ProductName;
  23. var Cost;
  24. var Name;
  25. var Price;
  26. var Discount;
  27. var Quantity;
  28. var TotalDiscount;
  29. var TotalCost;
  30. var TotalProductPurchases=TotalCost+1;
  31.  
  32. Name = prompt("Welcome to Gorman's Sports Agency. Please enter your name", "");
  33. alert("Hello "+Name+". Please look through our available products and services before placing your order.");
  34.  
  35. do
  36. {
  37. ProductName = prompt("What is the name of the service you require?", "");
  38. Quantity = prompt("How much of "+ProductName+" would you like?", "");
  39. order_confirm = confirm(""+Name+" you ordered "+Quantity+" of "+ProductName+". Is this correct?");
  40.  
  41. if(!order_confirm)
  42.  
  43. {
  44. alert("Refresh the page to reload and place a new order");
  45.  
  46. }
  47.  
  48.  
  49. else
  50. {
  51.  
  52. if(ProductName == "contract negotiation")
  53. { Price=200;
  54. Discount=.05; }
  55.  
  56. else if(ProductName == "legal counseling")
  57. { Price=350;
  58. Discount=.07; }
  59.  
  60. else if(ProductName == "contract extensions")
  61. { Price=125;
  62. Discount=.02; }
  63.  
  64. else if(ProductName == "career marketing")
  65. { Price=400;
  66. Discount=.1; }
  67.  
  68. else
  69. alert("Sorry, "+Name+". You entered an invalid product. We will not include this in your order");
  70.  
  71.  
  72. }
  73. Cost = Price*Quantity;
  74. TotalDiscount = Price*Quantity*Discount
  75. TotalCost = (Price*Quantity)-(Price*Quantity*Discount);
  76. TotalProductPurchases == TotalCost++
  77.  
  78.  
  79. document.write("The cost of buying "+Quantity+" of "+ProductName+" is $ "+Cost+"<br>");
  80. document.write("The Discount for this purchase is $"+TotalDiscount+"<br>");
  81. orderagain = confirm("Would you like to order again?");
  82. }
  83. while (orderagain);
  84. document.write("Thank you for placing an order with us, "+Name+"<br>");
  85. document.write("The total order cost is $"+TotalProductPurchases+"");
  86.  
  87.  
  88.  
  89.  
  90.  
  91. </script>
  92.  
  93.  
  94.  
  95.  
  96.  
  97.  
  98.  
  99.  
  100.  
  101.  
  102.  
  103.  
  104.  
  105.  
  106.  
  107.  
  108.  
  109.  
  110.  
  111.  
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124. </body>
  125. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement