Movie Program
Run then study carefully the code for Movie
You task it to make sure you can run this program on your machine, then make the following changes to it:
1. Before determining the price of the ticket, ask if the user has a $1 off coupon. If they do, then give them a dollar off the price
2. Once that works, add a third value. Ask if it is Wednesday. Tickets are half price on Wednesday from the lowest price. See if you can write code that correctly figures the correct price of the ticket:
For example, An adult with a coupon on Wednesday would pay $3.50 (8-1/2)
A student without a coupon on Wednesday would pay $2.50 (5-0/2)
An adult with a coupon on Friday would pay $7 (8-1)
A kid is always free
<html>
<!– Demo of using and (&&) to check conditions–>
<body>
<script type=”text/javascript”>
ttype = prompt(“Enter adult,student, or kid”,”adult”);
coupon = prompt(“Do you have a coupon”,”no”);
wed = prompt(“Is is Wednesday”,”no”);
if (ttype == “adult” && coupon == “yes” && wed == “yes”) {
document.write(“that will be $3.50 please.”);
}
</script>
</body>
</html>