Your program should allow me to order a sandwich and designate an on-campus address to which the sandwich will be delivered. I should have the option of either selecting a pre-made sandwich or of building my own sandwich. After I have ordered my sandwich, your program should display a window that lists exactly what type of sandwich I ordered and tells me the price of the sandwich. Different sandwiches should have different prices!
Remember that sandwiches have various components. They have bread, they have vegetables, they have condiments, and they have meat. I'm not a vegetarian. I like meat on my sandwich.
Your program should use all of the form elements we've discussed - radio buttons, checkboxes, text boxes, and select boxes. Before you start programming, you'll want to think very carefully about what type of form elements you are going to use for each stage of the ordering process.
1. The player rolls two 6-sided dice. 2. On the first roll
<html> <body> <head> <title>This page has errors</title> <script language="javascript"> function square(x) { y = x * x; } function output() { var inArray = new Array(5); var outArray; with(myForm) inArray[0] = parseInt(num1.value, 10); inArray[1] = parseInt(num2.value, 10); inArray[2] = parseInt(num3.value, 10); inArray[3] = parseInt(num4.value, 10); inArray[4] = parseInt(num5.value, 10); for(i=0; i<inArray.length; i++) { outArray(i) = square inArray[i]; with(document) { open(); write("<html><head><title>Squares rule!</title></head>"); write("<body>"); for(i=0; i<inArray.length; i++) { write("The square of + inArray[i] + " is " outArray[i] + "<p>"); } write("</body></html>"); close(); } </script> </head> <body> <form name="theForm"> Number 1:<input type="text" size=3 name="num1"><br> Number 2:<input type="text" size=3 name="num2"><br> Number 3:<input type="text" size=3 name="num3"><br> Number 4:<input type="text" size=3 name="num4"><br> Number 5:<input type="text" size=3 name="num2"><br> <p> <input type="button" value="Squares!" onclick="output"> </form> </body> </html>
var i=1; var answer=0; while(i <= 10) { answer = answer + (1/i); } ========== var answer=1; for(var i=0; i<10; i++) { answer = answer * (1/i); }