The Artima Developer Community
Sponsored Link

Design Forum
Can you help me finish this program.

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Faith

Posts: 2
Nickname: foxtrot
Registered: May, 2004

Can you help me finish this program. Posted: May 3, 2004 8:25 AM
Reply to this message Reply
Advertisement
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:
public class MovieTheater
{
public static void 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.

Thank you in advance
foxtrot

Topic: Help: Confusion about text in Design Pattern by GoF Previous Topic   Next Topic Topic: HOWTO retrieve an handle for a dialog box created with DialogBox()

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use