the user needs to be able to enter, “s, m, or l” for their quantity and continue to add(one at a time) until finished, then click the, “get total” button and see total. i am lost. i have my three functions, one for each size. i need direction and/or help plz.
i would also like to display the total as the user is adding.
the specials are for medium and large
second medium 4.99
after 3 large, get 10% off bill
<html>
<head><title>Maria’s Pizza Parlor</title></head>
<body>
<!– pizza stuff –>
<h1 align = “center”>Pizza Stand</h1>
<table border = “2” width = “30%” align = “center”>
<caption>pizza menu</caption>
<tr>
<th>size</th><th>price</th>
</tr>
<tr>
<td>small</td><td>$5.99 per pizza</td>
</tr>
<tr>
<td>medium</td><td>Buy one for $7.99; get the second for $4.99</td>
</tr>
<tr>
<td>large</td><td>$9.99 per pizza. Buy 3 or more and get 10% off your bill!</td>
</tr>
</table><br>
<hr><hr>
<!– create a form for input/output, but organize it with a table –>
<form name = “pizza stuff”>
<table border = “0” width = “75%” align = “center”>
<tr>
<td align = “right”>Select S for Small<br>M for Medium<br>L for Large
<input type = “text”
name = “itemID”
size = “2”>
<p>
Enter <b>H</b> for half day or <b>F</b> for full day
<input type = “text”
name = “time”
size = “2”>
</td>
<td align = “center”>
<input type = “button”
name = “Bcalculate”
value = “Find cost”
onClick = “pizzaCost()”>
</td>
<td width = “250” valign = “top”>
<div id = “out”></div>
</td>
</tr>
</table>
</form>
<script language = “javascript”>
//////////////////////////////////////////////////
// CALCULATION FUNCTION DEFINITION
/////////////////////////////////////////////////
/* calTotal() — function to determine the rate
* for renting a piece of equipment
*/
function calTotal() {
var cost;
var size; // used for display
var special; // used for display
var goodData = true; // used to keep track if input is valid or not
var display = “”; // string to gather my display text
var mp
var sp
var lp
var bill
var i;
var totals = new Array();
var GrandTotal=0;
var quantity=”Qty”;
var price = “ListPrice”
var total=”Total”;
// INPUT though the itemID is a digit, we won’t be doing any math with
// it, so leave it as a string
var size = document.pizza.itemID.value;
// regardless of whether the user entered lower or upper case, I’ll change
// that value to upper case so that we only have to test upper-case letters
type= itemSiz.toUpperCase();
// Let’s make sure the user entered valid data
if (type != “s” && type != “m” && type !=”l”) {
alert(“Invalid item number. Please try again”);
goodData = false;
}
// only continue if we have good data
if (goodData) {
/* PROCESS: Pizza cost, super order menu viola
*/
if (type == “s”){
var small = 5.99;
}
else if (mp>1){
var medTotal=7.99*1
medtotal+=(4.99*(mp-1));
}
else if(lp>3){
bill=bill-(.10*bill)
}
//////////////////////////////////////////////////////
// EVENT HANDLER
//////////////////////////////////////////////////////
// OUTPUT finally, the results
display += “<font color = ‘orange’><b>The pizza total is<u>” +
equipment + “</u> for a <u>” + timeLength +” day</u> is $”
+ bill.toFixed(2) + “</b></font>”;
document.getElementById(“out”).innerHTML = display;
}
}
</script>
</body>
</html>