Commit a1b4ad97 authored by hayden.gooi's avatar hayden.gooi

import random module

parent cdc4e595
package ar;
import java.util.Scanner;
import java.util.Random;
public class reservation{
public static String plane[][] = {{"XX", "XX", "XX"}, {"XX", "XX", "06"}, {"07", "08", "09"}, //Initialize the array which contains the plane seats
{"10", "11", "12"}, {"13", "14", "15"}, {"16", "17", "18"},
......@@ -11,9 +12,10 @@ public class reservation{
{"XX", "XX", "XX"}, {"XX", "XX", "XX"}, {"XX", "71", "72"},
{"73", "74", "75"}, {"76", "77", "78"}, {"79", "80", "81"},
{"82", "83", "84"}, {"85", "86", "87"}, {"88", "89", "90"}};
static Random random = new Random();
public static void main(String[] args) {//main subprogram
Scanner input = new Scanner(System.in);
int choice = 0;
String choice = "";
String reserve = "", section = "";
String first = "", last = "", city = "", destination = "";
System.out.println("Hello and Welcome. We first need some details-");
......@@ -30,8 +32,8 @@ public class reservation{
+ "\nPlease Type 1 for First Class"
+ "\nPlease Type 2 for Business"
+ "\nPlease Type 3 for Economy \n");
switch(choice = input.nextInt()) {//switch case to run different outcomes
case 1://case if user chooses first class/1
switch(choice = input.next()) {//switch case to run different outcomes
case "1"://case if user chooses first class/1
section = "First class";
System.out.println("You have Chosen First Class");//prints out the class that the user has chosen
boolean seat = false;
......@@ -130,10 +132,10 @@ public class reservation{
}
}
}
case 2://case if user chooses business class/2
case "2"://case if user chooses business class/2
System.out.println("You have Chosen Business Class");//prints out the class that the user has chosen
break;
case 3://case if user chooses economy class/3
case "3"://case if user chooses economy class/3
System.out.println("You have Chosen Economy Class");//prints out the class that the user has chosen
break;
default://case if user chooses an invalid option
......
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