<html>
<head>
<title> Javascript Assignment 1: [Ankur Chadha]</title>
</head>
<body>
<!--Ankur Chadha, Nikolay, Javascript Assignment 1, Due: 10/18/13-->
<h1> Welcome to My Online Store!</h1>
<h2> Disclaimer! We do not ship more than 20 units of plain bagels at a time due to low supply!</h2>
<table border="1">
<tr>
<th>Product</th>
<th>Price</th>
</tr>
<tr>
<td>Plain Bagel</td>
<td>$1.00</td>
</tr>
<tr>
<td>Poppyseed Bagel</td>
<td>$1.25</td>
</tr>
<tr>
<td>Philadelphia Cream Cheese Tub</td>
<td>$2.25</td>
</table>
<script type="text/javascript">
var Name = prompt ("Please Enter Your Name");
var Plain = 1*prompt ("Enter the Quantity of Plain Bagels you would like");
if (Plain > 20) {
alert("You have entered an amount to great to ship. Please refresh the page and try again!");
}
else {
var Poppyseed = 1 * prompt("Enter the Quantity of Poppyseed Bagels you would like");
var Creamcheese = 1 * prompt("Enter the Quantity of Tubs of Cream Cheese you would like");
var BillingAddress = prompt("Please enter the address of where you would like your delicious bagels shipped to in the following format: Street Address, City, State ZIP");
var subtotal = (Plain * 1) + (Poppyseed * 1.25) + (Creamcheese * 2.25);
var totalitem = Plain + Poppyseed + Creamcheese;
if ((Plain > 5 || Poppyseed > 5 || Creamcheese > 5) && (totalitem > 10)) {
subtotal = subtotal * .90 - subtotal * .90 * .05;
}
else if ((Plain <= 5 || Poppyseed <= 5 || Creamcheese <= 5) && (totalitem > 10)) {
subtotal = subtotal * .95;
}
else if ((Plain > 5 || Poppyseed > 5 || Creamcheese > 5) && (totalitem <= 10)) {
subtotal = subtotal * .90;
}
else if ((Plain <= 5 || Poppyseed <= 5 || Creamcheese <= 5) && (totalitem <= 10)) {
subtotal = (Plain * 1) + (Poppyseed * 1.25) + (Creamcheese * 2.25);
}
var taxRate = .07;
var Total = subtotal + (subtotal * taxRate);
document.write("CONFIRMATION: Thank you, " + Name, ". Your order totaling: $" + Total, " will be delievered to " + BillingAddress, " within 24 hours. Thank you for shopping with us.");
}
</script>
</body>
</html>