Commit fc4c08d6 authored by khale's avatar khale

Commit

parents
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="bin"/>
</classpath>
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>programming01</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.8
package programming01;
import java.util.Random;
import java.util.Scanner;
public class AirReservation {
// Random Int Generate
static Random random = new Random();
//flight number creator
static String FLnum = "FL" + random.nextInt(28 + 1);
// user input scanner
static Scanner input = new Scanner(System.in);
public static void main(String[] args) {
//Booking Page Start
System.out.println("Press a to begin the booking process ");
String user = input.next();
if (user.equals("a")) {
customer();
}
}
public static boolean customer() {
// TODO Auto-generated method stub
// customer details
System.out.println("Please, enter full name > ");
String name = input.next();
System.out.println("-----------------------------");
// Orgin City Input
System.out.println("Please, enter where you are flying from > ");
String origincity = input.next();
System.out.println("-----------------------------");
// Destination Input
System.out.println("Please, enter where you are flying to > ");
String destinationcity = input.next();
System.out.println("-----------------------------");
// Automatic FlightNumber Using RandomUtil
System.out.println("Your Flight Number is > " + FLnum);
System.out.println("-----------------------------");
// Choosing Flight Class
System.out.println(
"Please Type 1 for First Class \n"
+"Please Type 2 for Business Class \n"
+"Please Type 3 for Economy \n"
);
String classChoice = input.next();
switch (classChoice) {
case "1":
addFClass();
break;
case "2":
addBClass();
break;
case "3":
addEClass();
}
return false;
}
private static void addEClass() {
// TODO Auto-generated method stub
System.out.println("You have selected the Economy Class");
System.out.println("-----------------------------");
System.out.println("You will be assigned a seat automatically "
+ "Press a");
System.out.println("----------------------");
String a = input.next();
if(a.equals("a")) {
int x = random.nextInt(90);
int seatnum = x + 1;
System.out.println("Your seat number is " + seatnum);
System.out.println("-----------------------------");
};
}
private static void addBClass() {
// TODO Auto-generated method stub
System.out.println("You have selected the Business Class");
System.out.println("-----------------------------");
System.out.println("You will be assigned a seat automatically "
+ "Press a");
System.out.println("----------------------");
String a = input.next();
if(a.equals("a")) {
int x = random.nextInt(45);
int seatnum = x + 1;
System.out.println("Your seat number is " + seatnum);
System.out.println("-----------------------------");
};
}
private static void addFClass() {
// TODO Auto-generated method stub
System.out.println("You have selected the First Class");
System.out.println("-----------------------------");
System.out.println("You will be assigned a seat automatically "
+ "Press a");
System.out.println("----------------------");
String a = input.next();
if(a.equals("a")) {
int x = random.nextInt(18);
int seatnum = x + 1;
System.out.println("Your seat number is " + seatnum);
System.out.println("-----------------------------");
}
}
}
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