Commit c44069e2 authored by User's avatar User

comments

parent 2493412b
...@@ -15,23 +15,23 @@ public class reservation { ...@@ -15,23 +15,23 @@ public class reservation {
{"64", "65", "66"}, {"67", "68", "69"}, {"70", "71", "72"}, {"64", "65", "66"}, {"67", "68", "69"}, {"70", "71", "72"},
{"73", "74", "75"}, {"76", "77", "78"}, {"79", "80", "81"}, {"73", "74", "75"}, {"76", "77", "78"}, {"79", "80", "81"},
{"82", "83", "84"}, {"85", "86", "87"}, {"88", "89", "90"}}; {"82", "83", "84"}, {"85", "86", "87"}, {"88", "89", "90"}};
while(true) { while(true) {//loop to repeat code
System.out.print("Choose a flight Class-" System.out.print("Choose a flight Class-"//print out options to the user
+ "\nPlease Type 1 for First Class" + "\nPlease Type 1 for First Class"
+ "\nPlease Type 2 for Business" + "\nPlease Type 2 for Business"
+ "\nPlease Type 3 for Economy \n"); + "\nPlease Type 3 for Economy \n");
switch(choice = input.nextInt()) { switch(choice = input.nextInt()) {//switch case to run different outcomes
case 1: case 1://case if user chooses first class/1
System.out.println("You have Chosen First Class"); System.out.println("You have Chosen First Class");//prints out the class that the user has chosen
break; break;
case 2: case 2://case if user chooses business class/2
System.out.println("You have Chosen Business Class"); System.out.println("You have Chosen Business Class");//prints out the class that the user has chosen
break; break;
case 3: case 3://case if user chooses economy class/3
System.out.println("You have Chosen Economy Class"); System.out.println("You have Chosen Economy Class");//prints out the class that the user has chosen
break; break;
default: default://case if user chooses an invalid option
System.out.println("Invalid option. Please choose a number from 1 to 3\n------------"); System.out.println("Invalid option. Please choose a number from 1 to 3\n------------");//prints out an error message
break; break;
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment