Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <head>
- <title> Javascript Assignment 3: Chris Gorman
- </title>
- <h1> Gorman's Sports Agency-eCommerce </h1>
- </head>
- <body>
- <table bgcolor="red" border="1">
- <tr><td><h3>Service</h3></td><td><h3>Price</h3></td><td><h3>Discount</h3></td></tr>
- <tr><td>Contract Negotiation</td><td>$200</td><td>.05</td></tr>
- <tr><td>Legal Counseling</td><td>$350</td><td>.07</td></tr>
- <tr><td>Contract Extensions</td><td>$125</td><td>.02</td></tr>
- <tr><td>Career Marketing</td><td>$400</td><td>.10</td></tr>
- </table>
- <script type="text/javascript">
- /*
- Chris Gorman, Rohit, Javascript 3, November 4
- */
- var orderagain;
- var order_confirm;
- var ProductName;
- var Cost;
- var Name;
- var Price;
- var Discount;
- var Quantity;
- var TotalDiscount;
- var TotalCost;
- var TotalProductPurchases=TotalCost+1;
- Name = prompt("Welcome to Gorman's Sports Agency. Please enter your name", "");
- alert("Hello "+Name+". Please look through our available products and services before placing your order.");
- do
- {
- ProductName = prompt("What is the name of the service you require?", "");
- Quantity = prompt("How much of "+ProductName+" would you like?", "");
- order_confirm = confirm(""+Name+" you ordered "+Quantity+" of "+ProductName+". Is this correct?");
- if(!order_confirm)
- {
- alert("Refresh the page to reload and place a new order");
- }
- else
- {
- if(ProductName == "contract negotiation")
- { Price=200;
- Discount=.05; }
- else if(ProductName == "legal counseling")
- { Price=350;
- Discount=.07; }
- else if(ProductName == "contract extensions")
- { Price=125;
- Discount=.02; }
- else if(ProductName == "career marketing")
- { Price=400;
- Discount=.1; }
- else
- alert("Sorry, "+Name+". You entered an invalid product. We will not include this in your order");
- }
- Cost = Price*Quantity;
- TotalDiscount = Price*Quantity*Discount
- TotalCost = (Price*Quantity)-(Price*Quantity*Discount);
- TotalProductPurchases == TotalCost++
- document.write("The cost of buying "+Quantity+" of "+ProductName+" is $ "+Cost+"<br>");
- document.write("The Discount for this purchase is $"+TotalDiscount+"<br>");
- orderagain = confirm("Would you like to order again?");
- }
- while (orderagain);
- document.write("Thank you for placing an order with us, "+Name+"<br>");
- document.write("The total order cost is $"+TotalProductPurchases+"");
- </script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement