I have a problem in my loop. I want to keep asking the user which ticket type to purchase and how many they would like to buy until MAX_SEAT_COUNT <= totTickets. My code would only run through the questions once. MAX_SEAT_COUNT = 2200
do {
ticketType = prompt ("Ticket Types: Toddlers = 1 Juniors = 2 Adults = 3 Please enter a ticket type: 1, 2, 3", "");
if (ticketType == 1) {
manyToddlers = prompt ("How many toddler tickets are you purchasing? You can only buy 10 tickets per ticket type.", "");
} else if (ticketType == 2) {
manyJuniors = prompt ("How many junior tickets are you purchasing? You can only buy 10 tickets per ticket type.", "");
} else if (ticketType == 3) {
manyAdults = prompt ("How many adult tickets are you purchasing? You can only buy 10 tickets per ticket type.", "");
} else {
alert ("Please enter the correct number for each ticket type.");
}
if (manyToddlers <= 10) {
toddlersCounter = toddlersCounter + manyToddlers;
costToddlers = manyToddlers * toddlers;
alert ("You bought " + manyToddlers + " toddler tickets for $ " + costToddlers.toFixed(2));
} else if (manyJuniors <= 10) {
juniorsCounter = juniorsCounter + manyJuniors;
costJuniors = manyJuniors * juniors;
alert ("You bought " + manyJuniors + " junior tickets for $ " + costJuniors.toFixed(2));
} else if (manyAdults <= 10) {
adultsCounter = adultsCounter + manyAdults;
costAdults = manyAdults * adults;
alert ("You bought " + manyAdults + " adult tickets for $ " + costAdults.toFixed(2));
} else {
alert ("You can only buy 10 tickets per ticket type.");
}
totTickets = toddlersCounter + juniorsCounter + adultsCounter;
totSales = costToddlers + costJuniors + costAdults;
} while (MAX_SEAT_COUNT <= totTickets);