Help with my java project! :-)
Hi, im doing a java project and I'm stuck on a certain bit of it Here's what im being asked to do:
"The program should:
Display a seating plan for the theatre showing the seats that are booked and those that are available. For example, consider the following where:
o A # symbol represents an available seat.
o A P represents a booked premium seat.
o An R represents a booked regular seat.
o An E represents a booked economy seat."
This is my code so far:
Scanner keyboard = new Scanner(System.in);
int premium ;
int regular;
int economy;
int buyticket;
int ticket;
int numofticket;
int cancel;
int soldpremium = 0;
int soldregular = 0;
int soldeconomy = 0;
int count = 0;
double premiumPrice = 10;
double regularPrice = 7.50;
double economyPrice = 5;
String menuString;
String menu1 = "Book Seats";
String menu2 = "Reports";
String menu3 = "Cancellations";
String menu4 = "Exit";
menuString = ("\t\t\t Rory Gallagher Theatre\n\n" +
"1." + menu1 + "\n" +
"2." + menu2 + "\n" +
"3." + menu3 + "\n" +
"4." + menu4);
System.out.println(" " + menuString);
{
//display the stage
System.out.println("\t\tŠ STAGE Š");
System.out.println("\t'''''''''''''''''''");
System.out.println("P P P P P P P # # #");
System.out.println("# # # # # # # # # #");
System.out.println("R R R R R R R R R R");
System.out.println("R R R R R # # # # #");
System.out.println("# # # # # # # # # #");
System.out.println("# # # # # # # # # #");
System.out.println("# # # # # # # # # #");
System.out.println("# # # # # # # # # #");
System.out.println("E E # # # # # # # #");
System.out.println("# # # # # # # # # #");
}
double choice = keyboard.nextDouble();
/////while (count < 100)
//////{
if (choice ==1)
{
System.out.println("What type of seat do you want to buy tickets for?");
System.out.println("1 - Premium seat (10.00)");
System.out.println("2 - Regualar seat (7.50)");
System.out.println("3 - Economy seat (5.00)");
}
double choice1 = keyboard.nextDouble();
if (choice1 ==1)
{
System.out.println("You have selected Premium seats for 10.00");
System.out.println("How many tickets do you want to buy?");
premium = keyboard.nextInt();
System.out.println("You have booked " + premium + " tickets, Your total price is: " + premium*premiumPrice);
}
if (choice1 ==2)
{
System.out.println("You have selected Regular seats for 7.50");
System.out.println("How many tickets do you want to buy?");
regular = keyboard.nextInt();
System.out.println("You have booked " + regular + " tickets, Your total price is: " + regular*regularPrice) ;
}
if (choice1 ==3)
{
System.out.println("You have selected Economy seats for 5.00");
System.out.println("How many tickets do you want to buy?");
economy = keyboard.nextInt();
System.out.println("You have booked " + economy + " tickets, Your total price is: " + economy*economyPrice) ;
}
else if (choice ==2)
{
System.out.println(" Sales Summary");
System.out.println("==============");
System.out.println("The number of premium tickets sold\n:" + soldpremium);
System.out.println("The number of regular tickets sold\n:" + soldregular);
System.out.println("The number of economy tickets sold\n:" + soldeconomy);
System.out.println(" Sales Bar Chart");
System.out.println("================");
System.out.println("Number of premium tickets sold\n:" );
System.out.println("Number of regular tickets sold\n:" );
System.out.println("Number of economy tickets sold\n:" );
System.out.println(" Ticket Availability");
System.out.println("================");
System.out.println(" Premium tickets ");
System.out.println(" Regular tickets ");
System.out.println(" Economy tickets ");
System.out.println("Sales Bar Chart");
System.out.println("==================");
System.out.println("Number of Premium Tickets Sold:" + "|" * soldpremium);
System.out.println("Number of Regular Tickets Sold:" + "|" * soldregular);
System.out.println("Number of Economy Tickets Sold:" + "|" * soldeconomy);
}
else if (choice ==3)
{
}
else if (choice ==3)
{
System.out.println("What type of ticket do you want to cancel?");
System.out.println("1 - Premium seat ");
System.out.println("2 - Regual seat ");
System.out.println("3 - Economy seat");
System.out.println("Entre a value between 1 and 3:");
}
double choice2 = keyboard.nextDouble();
if (choice2 == 1 )
{
System.out.println("How many tickets would you like to cancel?");
numofticket = keyboard.nextInt();
System.out.println("You have canceled " + numofticket + " tickets, will refund ():" + 10.00*numofticket );
}
if (choice2 == 2 )
{
System.out.println("How many tickets would you like to cancel?");
numofticket = keyboard.nextInt();
System.out.println("You have canceled " + numofticket + " tickets, will refund ():" + 7.50*numofticket );
}
if (choice2 == 3 )
{
System.out.println("How many tickets would you like to cancel?");
numofticket = keyboard.nextInt();
System.out.println("You have canceled " + numofticket + " tickets, will refund ():" + 5.00*numofticket );
}
}
////}
}
"
Please help me, im new to java! :-)
Re: Help with my java project! :-)
When posting code, please use the code tags. Unformatted code is pretty impossible to read.
What does this code do? What is it supposed to do? You've posted your homework and some code, but no explanation of what it does or what you need help with.
You should consider condensing your problem into an SSCCE that we can copy and paste to run as well as asking a specific technical question.
Re: Help with my java project! :-)
What seems to be the problem?
Re: Help with my java project! :-)
Re: Help with my java project! :-)