Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
Airline Reservation
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ben.leaver
Airline Reservation
Commits
2d4b4fdd
Commit
2d4b4fdd
authored
Nov 04, 2019
by
ben.leaver
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Final commit of finished airline reservation code
parents
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
368 additions
and
0 deletions
+368
-0
.classpath
.classpath
+6
-0
.gitignore
.gitignore
+1
-0
.project
.project
+17
-0
org.eclipse.jdt.core.prefs
.settings/org.eclipse.jdt.core.prefs
+11
-0
AirlineReservationProject.java
src/Reservation/AirlineReservationProject.java
+333
-0
No files found.
.classpath
0 → 100644
View file @
2d4b4fdd
<?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>
.gitignore
0 → 100644
View file @
2d4b4fdd
/bin/
.project
0 → 100644
View file @
2d4b4fdd
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>
Airline reservation
</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>
.settings/org.eclipse.jdt.core.prefs
0 → 100644
View file @
2d4b4fdd
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
src/Reservation/AirlineReservationProject.java
0 → 100644
View file @
2d4b4fdd
package
Reservation
;
import
java.util.ArrayList
;
import
java.util.Scanner
;
public
class
AirlineReservationProject
{
public
static
double
getRandomIntegerBetweenRange
(
double
min
,
double
max
){
double
x
=
(
int
)(
Math
.
random
()*((
max
-
min
)+
1
))+
min
;
return
x
;
}
static
ArrayList
<
String
>
name
=
new
ArrayList
<
String
>();
static
ArrayList
<
String
>
away
=
new
ArrayList
<
String
>();
static
ArrayList
<
String
>
to
=
new
ArrayList
<
String
>();
static
ArrayList
<
Double
>
flight
=
new
ArrayList
<
Double
>();
static
ArrayList
<
Double
>
First
=
new
ArrayList
<
Double
>();
static
ArrayList
<
Double
>
Business
=
new
ArrayList
<
Double
>();
static
ArrayList
<
Double
>
Econ
=
new
ArrayList
<
Double
>();
static
ArrayList
<
String
>
FirstM
=
new
ArrayList
<
String
>();
static
ArrayList
<
String
>
BusinessM
=
new
ArrayList
<
String
>();
static
ArrayList
<
String
>
EconM
=
new
ArrayList
<
String
>();
static
ArrayList
<
String
>
boardingPass
=
new
ArrayList
<
String
>();
static
ArrayList
<
String
>
bpass
=
new
ArrayList
<
String
>();
static
ArrayList
<
String
>
boardingPassManual
=
new
ArrayList
<
String
>();
static
ArrayList
<
String
>
bpassManual
=
new
ArrayList
<
String
>();
static
Scanner
input
=
new
Scanner
(
System
.
in
);
public
static
void
main
(
String
[]
args
)
{
// Enter name and details for flight
System
.
out
.
println
(
"Hello, Welcome to Leaver Airlines please enter your full name > "
);
String
nameFull
=
input
.
nextLine
();
name
.
add
(
nameFull
);
System
.
out
.
println
(
"Please enter the city you are traveling from > "
);
String
awayCity
=
input
.
nextLine
();
away
.
add
(
awayCity
);
System
.
out
.
println
(
"Please enter the city you wish to travel to > "
);
String
toCity
=
input
.
nextLine
();
to
.
add
(
toCity
);
double
flightNmbr
=
getRandomIntegerBetweenRange
(
1
,
28
);
System
.
out
.
println
(
"Your Flight number is FL"
+
flightNmbr
);
flight
.
add
(
flightNmbr
);
System
.
out
.
println
(
"Please enter F for First class, B for Business class "
+
"and E for economy"
);
String
user
=
input
.
next
();
// Select class
if
(
user
.
contentEquals
(
"F"
))
{
Firstclass
();}
// Go to First class seating
else
if
(
user
.
contentEquals
(
"B"
))
Business
();
// Go to Business seating
else
if
(
user
.
contentEquals
(
"E"
))
Economy
();
}
// Go to Economy seating
// First class section
private
static
void
Firstclass
()
{
System
.
out
.
println
(
"Welcome to First class. "
+
" \n If you would like us to assign you a seat please press Y, "
+
"if you would like to select your own seat press N > "
);
String
SeatChoiceF
=
input
.
next
();
if
(
SeatChoiceF
.
contentEquals
(
"Y"
))
{
double
SeatF
=
getRandomIntegerBetweenRange
(
1
,
18
);
System
.
out
.
println
(
"Your seat number is "
+
SeatF
);
First
.
add
(
SeatF
);
System
.
out
.
println
(
"Please enter B to recieve your Boarding Pass > "
);
String
boardingPass
=
input
.
next
();
bpass
.
add
(
boardingPass
);
if
(
boardingPass
.
contentEquals
(
"B"
))
{
System
.
out
.
println
(
"Thank you, here is your boarding pass > "
);
System
.
out
.
println
(
"Name : "
+
name
);
System
.
out
.
println
(
"From : "
+
away
);
System
.
out
.
println
(
"To : "
+
to
);
System
.
out
.
println
(
"Flight Number : FL"
+
flight
);
System
.
out
.
println
(
"Seat Number : "
+
First
);
System
.
out
.
println
(
"Section : [First Class]"
);
}
}
else
if
(
SeatChoiceF
.
contentEquals
(
"N"
))
{
int
plane
[][];
plane
=
new
int
[
10
][
10
];
plane
[
0
][
0
]
=
1
;
plane
[
0
][
1
]
=
2
;
plane
[
0
][
2
]
=
3
;
plane
[
0
][
3
]
=
4
;
plane
[
0
][
4
]
=
5
;
plane
[
0
][
5
]
=
6
;
plane
[
0
][
6
]
=
7
;
plane
[
0
][
7
]
=
8
;
plane
[
0
][
8
]
=
9
;
plane
[
1
][
0
]
=
10
;
plane
[
1
][
1
]
=
11
;
plane
[
1
][
2
]
=
12
;
plane
[
1
][
3
]
=
13
;
plane
[
1
][
4
]
=
14
;
plane
[
1
][
5
]
=
15
;
plane
[
1
][
6
]
=
16
;
plane
[
1
][
7
]
=
17
;
plane
[
1
][
8
]
=
18
;
System
.
out
.
println
(
"["
+
plane
[
0
][
0
]
+
"] ["
+
plane
[
0
][
1
]
+
"] ["
+
plane
[
0
][
2
]
+
"] ["
+
plane
[
0
][
3
]
+
"] ["
+
plane
[
0
][
4
]
+
"] ["
+
plane
[
0
][
5
]
+
"] ["
+
plane
[
0
][
6
]
+
"] ["
+
plane
[
0
][
7
]
+
"] ["
+
plane
[
0
][
8
]
+
"]"
);
System
.
out
.
println
(
"["
+
plane
[
1
][
0
]
+
"]["
+
plane
[
1
][
1
]
+
"]["
+
plane
[
1
][
2
]
+
"] ["
+
plane
[
1
][
3
]
+
"]["
+
plane
[
1
][
4
]
+
"]["
+
plane
[
1
][
5
]
+
"] ["
+
plane
[
1
][
6
]
+
"]["
+
plane
[
1
][
7
]
+
"]["
+
plane
[
1
][
8
]
+
"]"
);
System
.
out
.
println
(
"Please select your seat number from the available seats > "
);
String
SeatFirst
=
input
.
next
();
FirstM
.
add
(
SeatFirst
);
System
.
out
.
println
(
"Please enter B to recieve your Boarding Pass > "
);
String
boardingPassManual
=
input
.
next
();
bpassManual
.
add
(
boardingPassManual
);
if
(
boardingPassManual
.
contentEquals
(
"B"
))
{
System
.
out
.
println
(
"Thank you, here is your boarding pass > "
);
System
.
out
.
println
(
"Name : "
+
name
);
System
.
out
.
println
(
"From : "
+
away
);
System
.
out
.
println
(
"To : "
+
to
);
System
.
out
.
println
(
"Flight Number : FL"
+
flight
);
System
.
out
.
println
(
"Seat Number : "
+
FirstM
);
System
.
out
.
println
(
"Section : [First Class]"
);
}
}
}
// End switch case
// Business section
private
static
void
Business
()
{
System
.
out
.
println
(
"Welcome to Business. "
+
" \n If you would like us to assign you a seat please press Y, "
+
"if you would like to select your own seat press N > "
);
String
SeatChoiceB
=
input
.
next
();
if
(
SeatChoiceB
.
contentEquals
(
"Y"
))
{
double
SeatB
=
getRandomIntegerBetweenRange
(
19
,
45
);
System
.
out
.
println
(
"Your seat number is "
+
SeatB
);
Business
.
add
(
SeatB
);
System
.
out
.
println
(
"Please enter B to recieve your Boarding Pass > "
);
String
boardingPass
=
input
.
next
();
bpass
.
add
(
boardingPass
);
if
(
boardingPass
.
contentEquals
(
"B"
))
{
System
.
out
.
println
();
System
.
out
.
println
(
"Thank you, here is your boarding pass > "
);
System
.
out
.
println
(
"Name : "
+
name
);
System
.
out
.
println
(
"From : "
+
away
);
System
.
out
.
println
(
"To : "
+
to
);
System
.
out
.
println
(
"Flight Number : FL"
+
flight
);
System
.
out
.
println
(
"Seat Number : "
+
Business
);
System
.
out
.
println
(
"Section : [Business]"
);
}
}
else
if
(
SeatChoiceB
.
contentEquals
(
"N"
))
{
int
plane
[][];
plane
=
new
int
[
10
][
10
];
plane
[
2
][
0
]
=
19
;
plane
[
2
][
1
]
=
20
;
plane
[
2
][
2
]
=
21
;
plane
[
2
][
3
]
=
22
;
plane
[
2
][
4
]
=
23
;
plane
[
2
][
5
]
=
24
;
plane
[
2
][
6
]
=
25
;
plane
[
2
][
7
]
=
26
;
plane
[
2
][
8
]
=
27
;
plane
[
3
][
0
]
=
28
;
plane
[
3
][
1
]
=
29
;
plane
[
3
][
2
]
=
30
;
plane
[
3
][
3
]
=
31
;
plane
[
3
][
4
]
=
32
;
plane
[
3
][
5
]
=
33
;
plane
[
3
][
6
]
=
34
;
plane
[
3
][
7
]
=
35
;
plane
[
3
][
8
]
=
36
;
plane
[
4
][
0
]
=
37
;
plane
[
4
][
1
]
=
38
;
plane
[
4
][
2
]
=
39
;
plane
[
4
][
3
]
=
40
;
plane
[
4
][
4
]
=
41
;
plane
[
4
][
5
]
=
42
;
plane
[
4
][
6
]
=
43
;
plane
[
4
][
7
]
=
44
;
plane
[
4
][
8
]
=
45
;
System
.
out
.
println
(
"["
+
plane
[
2
][
0
]
+
"]["
+
plane
[
2
][
1
]
+
"]["
+
plane
[
2
][
2
]
+
"] ["
+
plane
[
2
][
3
]
+
"]["
+
plane
[
2
][
4
]
+
"]["
+
plane
[
2
][
5
]
+
"] ["
+
plane
[
2
][
6
]
+
"]["
+
plane
[
2
][
7
]
+
"]["
+
plane
[
2
][
8
]
+
"]"
);
System
.
out
.
println
(
"["
+
plane
[
3
][
0
]
+
"]["
+
plane
[
3
][
1
]
+
"]["
+
plane
[
3
][
2
]
+
"] ["
+
plane
[
3
][
3
]
+
"]["
+
plane
[
3
][
4
]
+
"]["
+
plane
[
3
][
5
]
+
"] ["
+
plane
[
3
][
6
]
+
"]["
+
plane
[
3
][
7
]
+
"]["
+
plane
[
3
][
8
]
+
"]"
);
System
.
out
.
println
(
"["
+
plane
[
4
][
0
]
+
"]["
+
plane
[
4
][
1
]
+
"]["
+
plane
[
4
][
2
]
+
"] ["
+
plane
[
4
][
3
]
+
"]["
+
plane
[
4
][
4
]
+
"]["
+
plane
[
4
][
5
]
+
"] ["
+
plane
[
4
][
6
]
+
"]["
+
plane
[
4
][
7
]
+
"]["
+
plane
[
4
][
8
]
+
"]"
);
System
.
out
.
println
(
"Please select your seat number from the available seats > "
);
String
SeatBusiness
=
input
.
next
();
BusinessM
.
add
(
SeatBusiness
);
System
.
out
.
println
(
"Please enter B to recieve your Boarding Pass > "
);
String
boardingPass
=
input
.
next
();
bpass
.
add
(
boardingPass
);
if
(
boardingPass
.
contentEquals
(
"B"
))
{
System
.
out
.
println
();
System
.
out
.
println
(
"Thank you, here is your boarding pass > "
);
System
.
out
.
println
(
"Name : "
+
name
);
System
.
out
.
println
(
"From : "
+
away
);
System
.
out
.
println
(
"To : "
+
to
);
System
.
out
.
println
(
"Flight Number : FL"
+
flight
);
System
.
out
.
println
(
"Seat Number : "
+
BusinessM
);
System
.
out
.
println
(
"Section : [Business]"
);
}
}
// End switch case
}
// Economy section
private
static
void
Economy
()
{
System
.
out
.
println
(
"Welcome to Economy. "
+
"\n If you would like us to assign you a seat please press Y, "
+
"if you would like to select your own seat please press N > "
);
String
SeatChoiceE
=
input
.
next
();
if
(
SeatChoiceE
.
contentEquals
(
"Y"
))
{
double
SeatE
=
getRandomIntegerBetweenRange
(
46
,
90
);
System
.
out
.
println
(
"Your seat number is "
+
SeatE
);
Econ
.
add
(
SeatE
);
System
.
out
.
println
(
"Please enter B to recieve your Boarding Pass > "
);
String
boardingPass
=
input
.
next
();
bpass
.
add
(
boardingPass
);
if
(
boardingPass
.
contentEquals
(
"B"
))
{
System
.
out
.
println
(
"Thank you, here is your boarding pass > "
);
System
.
out
.
println
(
"Name : "
+
name
);
System
.
out
.
println
(
"From : "
+
away
);
System
.
out
.
println
(
"To : "
+
to
);
System
.
out
.
println
(
"Flight Number : FL"
+
flight
);
System
.
out
.
println
(
"Seat Number : "
+
Econ
);
System
.
out
.
println
(
"Section : [Economy]"
);
}
}
else
if
(
SeatChoiceE
.
contentEquals
(
"N"
))
{
int
plane
[][];
plane
=
new
int
[
10
][
10
];
plane
[
5
][
0
]
=
46
;
plane
[
5
][
1
]
=
47
;
plane
[
5
][
2
]
=
48
;
plane
[
5
][
3
]
=
49
;
plane
[
5
][
4
]
=
50
;
plane
[
5
][
5
]
=
51
;
plane
[
5
][
6
]
=
52
;
plane
[
5
][
7
]
=
53
;
plane
[
5
][
8
]
=
54
;
plane
[
6
][
0
]
=
55
;
plane
[
6
][
1
]
=
56
;
plane
[
6
][
2
]
=
57
;
plane
[
6
][
3
]
=
58
;
plane
[
6
][
4
]
=
59
;
plane
[
6
][
5
]
=
60
;
plane
[
6
][
6
]
=
61
;
plane
[
6
][
7
]
=
62
;
plane
[
6
][
8
]
=
63
;
plane
[
7
][
0
]
=
64
;
plane
[
7
][
1
]
=
65
;
plane
[
7
][
2
]
=
66
;
plane
[
7
][
3
]
=
67
;
plane
[
7
][
4
]
=
68
;
plane
[
7
][
5
]
=
69
;
plane
[
7
][
6
]
=
70
;
plane
[
7
][
7
]
=
71
;
plane
[
7
][
8
]
=
72
;
plane
[
8
][
0
]
=
73
;
plane
[
8
][
1
]
=
74
;
plane
[
8
][
2
]
=
75
;
plane
[
8
][
3
]
=
76
;
plane
[
8
][
4
]
=
77
;
plane
[
8
][
5
]
=
78
;
plane
[
8
][
6
]
=
79
;
plane
[
8
][
7
]
=
80
;
plane
[
8
][
8
]
=
81
;
plane
[
9
][
0
]
=
82
;
plane
[
9
][
1
]
=
83
;
plane
[
9
][
2
]
=
84
;
plane
[
9
][
3
]
=
85
;
plane
[
9
][
4
]
=
86
;
plane
[
9
][
5
]
=
87
;
plane
[
9
][
6
]
=
88
;
plane
[
9
][
7
]
=
89
;
plane
[
9
][
8
]
=
90
;
System
.
out
.
println
(
"["
+
plane
[
5
][
0
]
+
"]["
+
plane
[
5
][
1
]
+
"]["
+
plane
[
5
][
2
]
+
"] ["
+
plane
[
5
][
3
]
+
"]["
+
plane
[
5
][
4
]
+
"]["
+
plane
[
5
][
5
]
+
"] ["
+
plane
[
5
][
6
]
+
"]["
+
plane
[
5
][
7
]
+
"]["
+
plane
[
5
][
8
]
+
"]"
);
System
.
out
.
println
(
"["
+
plane
[
6
][
0
]
+
"]["
+
plane
[
6
][
1
]
+
"]["
+
plane
[
6
][
2
]
+
"] ["
+
plane
[
6
][
3
]
+
"]["
+
plane
[
6
][
4
]
+
"]["
+
plane
[
6
][
5
]
+
"] ["
+
plane
[
6
][
6
]
+
"]["
+
plane
[
6
][
7
]
+
"]["
+
plane
[
6
][
8
]
+
"]"
);
System
.
out
.
println
(
"["
+
plane
[
7
][
0
]
+
"]["
+
plane
[
7
][
1
]
+
"]["
+
plane
[
7
][
2
]
+
"] ["
+
plane
[
7
][
3
]
+
"]["
+
plane
[
7
][
4
]
+
"]["
+
plane
[
7
][
5
]
+
"] ["
+
plane
[
7
][
6
]
+
"]["
+
plane
[
7
][
7
]
+
"]["
+
plane
[
7
][
8
]
+
"]"
);
System
.
out
.
println
(
"["
+
plane
[
8
][
0
]
+
"]["
+
plane
[
8
][
1
]
+
"]["
+
plane
[
8
][
2
]
+
"] ["
+
plane
[
8
][
3
]
+
"]["
+
plane
[
8
][
4
]
+
"]["
+
plane
[
8
][
5
]
+
"] ["
+
plane
[
8
][
6
]
+
"]["
+
plane
[
8
][
7
]
+
"]["
+
plane
[
8
][
8
]
+
"]"
);
System
.
out
.
println
(
"["
+
plane
[
9
][
0
]
+
"]["
+
plane
[
9
][
1
]
+
"]["
+
plane
[
9
][
2
]
+
"] ["
+
plane
[
9
][
3
]
+
"]["
+
plane
[
9
][
4
]
+
"]["
+
plane
[
9
][
5
]
+
"] ["
+
plane
[
9
][
6
]
+
"]["
+
plane
[
9
][
7
]
+
"]["
+
plane
[
9
][
8
]
+
"]"
);
System
.
out
.
println
(
"Please select your seat number from the available seats > "
);
String
SeatEcon
=
input
.
next
();
EconM
.
add
(
SeatEcon
);
System
.
out
.
println
(
"Please enter B to recieve your Boarding Pass > "
);
String
boardingPass
=
input
.
next
();
bpass
.
add
(
boardingPass
);
if
(
boardingPass
.
contentEquals
(
"B"
))
{
System
.
out
.
println
(
"Thank you, here is your boarding pass > "
);
System
.
out
.
println
(
"Name : "
+
name
);
System
.
out
.
println
(
"From : "
+
away
);
System
.
out
.
println
(
"To : "
+
to
);
System
.
out
.
println
(
"Flight Number : FL"
+
flight
);
System
.
out
.
println
(
"Seat Number : "
+
EconM
);
System
.
out
.
println
(
"Section : [Economy]"
);
}
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment