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

import random module

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