|
<html> <!-- roll.html Dave Reed --> <!-- This page simulates dice rolls until doubles are obtained. --> <!---------------------------------------------------------------->
<head> <title> Dice Stats </title> <script type="text/javascript" src="http://www.prenhall.com/reed/random.js"> </script> <script type="text/javascript"> var age,wed,coupon,price;
age = window.prompt("adult, student, or child?",""); wed = window.prompt ("Is it wednesday?","no"); coupon = window.prompt("Do you have a coupon?","no");
document.writeln(age); if (age == 'adult') { price=9; } if (age == 'student') { price = 5; }
if (age == 'child') { price = 2; }
if ( wed == 'yes') { price = price/2; }
if (coupon== 'yes') { price = price-1; }
document.writeln("Your charge is " + price); </script> </head>
<body> </body> </html>
|