Grrrrrrrrrrrrrrrrrrrrrrrrr
I need this as a sentinel controlled loop. Any suggestions? am I on the right track?
<SCRIPT LANGUAGE = "JavaScript"> /* This code takes input from user, adds it all up and gives a total at the bottom
* of all the products for seven days and the corresponding value of them all */
var retail_price, validInput = true, counter = 1, total = 0, amount_sold = 0, total_retail_value = 0;
do {
pro_num = window.prompt ("Enter a product number (1-5)", "0");
pro_num_value = parseInt(pro_num);
switch (pro_num_value) {
case "1":
price = 2.98;
break;
case "2":
price = 4.50;
break;
case "3":
price = 9.98;
break;
case "4":
price = 4.49;
break;
case "5":
price = 6.87;
break;
default:
validInput = false;
}
if ( validInput = true) {
amount_sold = price * window.prompt("Enter number of products sold", "0");}
total_retail_value += amount_sold;
}
while (pro_num != -1)
document.writeln("Total Retail Value of all products sold over 7 days equals: " + total_retail_value);
</SCRIPT></code></p>
<SCRIPT LANGUAGE = "JavaScript"> /* This code takes input from user, adds it all up and gives a total at the bottom
* of all the products for seven days and the corresponding value of them all */
var retail_price, validInput = true, counter = 1, total = 0, amount_sold = 0, total_retail_value = 0;
do {
pro_num = window.prompt ("Enter a product number (1-5)", "0");
pro_num_value = parseInt(pro_num);
switch (pro_num_value) {
case "1":
price = 2.98;
break;
case "2":
price = 4.50;
break;
case "3":
price = 9.98;
break;
case "4":
price = 4.49;
break;
case "5":
price = 6.87;
break;
default:
validInput = false;
}
if ( validInput = true) {
amount_sold = price * window.prompt("Enter number of products sold", "0");}
total_retail_value += amount_sold;
}
while (pro_num != -1)
document.writeln("Total Retail Value of all products sold over 7 days equals: " + total_retail_value);
</SCRIPT></code></p>
