I am having difficulty with the following program. Choose an item form the following menu: 1.view tody's movie schedule, Obtain pricing information 3. buy tickets 4. Quit
When the user chooses #1,# 2, 0r # 3, execute the actions described below. Then return the user back to the menu and allow them to choose again. When the user chooses # 4, exit the program.
For choice # 1 dsplay: I love Java, rated pg, showing at 1:35, 4:35, 7:35.10:35 I hate java , rated PG13, showing at 3:35,6:35,10:35 I despise java, rated R, showing at 7:30,10:30,12:00
For choice # 2 display: How old is the person using the ticket, enter a -1 to quit_ accept an age if the person is between 0 and 12 display "The price for children 12 and under is $4.00. If the age is between 13 and 65, display "the price for adults is $6.00. If the age is over 65, displsy"The price for seniors over 65 is $4.50. If the age is <0, quit.
For choice # 3 display How many child tickets do you wish to order? accept the # ordered How many adult tickets do you wish to order? Accept# How many senior tickets do you wish to order? Accept #
THEN Calculate and display You ordered_________child tickets You ordered ________adult tickets You ordered _______senior tickets Your total cost is $ _________Display total amount spent on tickets
For coice # 4 exit the program.
MY code so far reads:
publicclass MovieTheater
{
publicstaticvoid main (String []args)throws Exception
{
char selection;
double price;
int numberTickets;
System.out.println("Please choose from the following selections");
System.out.println("Enter 1 to view today's movie selection");
System.out.println("Enter 2 to obtain pricing info.")
System.out.println("Enter 3 to buy tickets");
System.out.println("Enter 4 to obtain a quote");
selection = (char)System.in.read();
System.in.read();
if (selection == '1');
{
System.out.println("I love Java, rated pg, showing at 1:35, 4:35, 7:35.10:35");
System.out.println("I hate java , rated PG13, showing at 3:35,6:35,10:35");
System.out.println("I despise java, rated R, showing at 7:30,10:30,12:00");
}
if (selection =='2')
{
System.out.println(How old is the person using the ticket, enter a -1 to quit");
/*When I enter an age it only executes the print statement the price for adults is $6.00 (no matter what age I enter.
age =(int)System,in.read();
System.in.read();
if (age >0 && age <=12)
}
System.out.println("The price for children 12 and under is $4.00);
{
else if (age >=13 && age <=65)
{
System.out.println("the price for adults is $6.00.");
}
else if (age >65)
{
System.out.println("The price for seniors over 65 is $4.50);
}
else
{
System.out.println("Quit);
}
if (selection == '3')
{
System.out.println("How many child tickets do you wish to order?");
System.out.println("How many adult tickets do you wish to order? ");
System.out.println("How many senior tickets do you wish to order?");
}
if (selection == '4');
System.out.println("End program");
}
}
}
}
I am not sure how to proceed with this one, so any help would be greatly appreciated.