Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
AirlineReservation
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
hayden.gooi
AirlineReservation
Commits
10fba06b
Commit
10fba06b
authored
Nov 03, 2019
by
User
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
boarding pass
parent
843a989a
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
17 deletions
+26
-17
reservation.java
src/airlinereservation/reservation.java
+26
-17
No files found.
src/airlinereservation/reservation.java
View file @
10fba06b
package
airlinereservation
;
package
airlinereservation
;
import
java.util.Scanner
;
//import scanner module
import
java.util.Scanner
;
//import scanner module
public
class
reservation
{
public
class
reservation
{
public
static
String
plane
[][]
=
{{
"XX"
,
"XX"
,
"XX"
},
{
"XX"
,
"XX"
,
"06"
},
{
"07"
,
"08"
,
"09"
},
//initialise the array which contains the plane seats
public
static
void
main
(
String
[]
args
)
{
//main subprogram
Scanner
input
=
new
Scanner
(
System
.
in
);
int
choice
=
0
;
String
reserve
=
""
;
String
plane
[][]
=
{{
"XX"
,
"XX"
,
"XX"
},
{
"XX"
,
"XX"
,
"06"
},
{
"07"
,
"08"
,
"09"
},
//initialise 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"
},
{
"XX"
,
"XX"
,
"XX"
},
{
"XX"
,
"XX"
,
"XX"
},
{
"XX"
,
"XX"
,
"XX"
},
{
"XX"
,
"XX"
,
"XX"
},
{
"XX"
,
"XX"
,
"XX"
},
{
"XX"
,
"XX"
,
"XX"
},
{
"28"
,
"29"
,
"30"
},
{
"31"
,
"32"
,
"33"
},
{
"34"
,
"35"
,
"36"
},
{
"28"
,
"29"
,
"30"
},
{
"31"
,
"32"
,
"33"
},
{
"34"
,
"35"
,
"36"
},
...
@@ -16,6 +11,10 @@ public class reservation {
...
@@ -16,6 +11,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"
}};
public
static
void
main
(
String
[]
args
)
{
//main subprogram
Scanner
input
=
new
Scanner
(
System
.
in
);
int
choice
=
0
;
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-"
);
System
.
out
.
print
(
"Please enter your first name: "
);
System
.
out
.
print
(
"Please enter your first name: "
);
...
@@ -33,6 +32,7 @@ public class reservation {
...
@@ -33,6 +32,7 @@ public class reservation {
+
"\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
.
nextInt
())
{
//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"
;
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
;
for
(
int
p
=
0
;
p
<
6
;
p
++)
{
for
(
int
p
=
0
;
p
<
6
;
p
++)
{
...
@@ -55,7 +55,7 @@ public class reservation {
...
@@ -55,7 +55,7 @@ public class reservation {
reserve
=
plane
[
s
][
r
];
reserve
=
plane
[
s
][
r
];
plane
[
s
][
r
]
=
"XX"
;
plane
[
s
][
r
]
=
"XX"
;
System
.
out
.
println
(
"Your booked seat is "
+
reserve
);
System
.
out
.
println
(
"Your booked seat is "
+
reserve
);
ticket
();
ticket
(
first
,
last
,
city
,
destination
,
section
,
reserve
);
return
;
return
;
}
}
}
}
...
@@ -76,7 +76,7 @@ public class reservation {
...
@@ -76,7 +76,7 @@ public class reservation {
if
(
reserve
.
equals
(
plane
[
s
][
r
]))
{
if
(
reserve
.
equals
(
plane
[
s
][
r
]))
{
System
.
out
.
println
(
"Seat "
+
reserve
+
" has been booked for you"
);
System
.
out
.
println
(
"Seat "
+
reserve
+
" has been booked for you"
);
plane
[
s
][
r
]
=
"XX"
;
plane
[
s
][
r
]
=
"XX"
;
ticket
();
ticket
(
first
,
last
,
city
,
destination
,
section
,
reserve
);
return
;
return
;
}
}
}
}
...
@@ -104,7 +104,7 @@ public class reservation {
...
@@ -104,7 +104,7 @@ public class reservation {
reserve
=
plane
[
s
][
r
];
reserve
=
plane
[
s
][
r
];
plane
[
s
][
r
]
=
"XX"
;
plane
[
s
][
r
]
=
"XX"
;
System
.
out
.
println
(
"Your booked seat is "
+
reserve
);
System
.
out
.
println
(
"Your booked seat is "
+
reserve
);
ticket
();
ticket
(
first
,
last
,
city
,
destination
,
section
,
reserve
);
return
;
return
;
}
}
}
}
...
@@ -202,8 +202,17 @@ public class reservation {
...
@@ -202,8 +202,17 @@ public class reservation {
System
.
out
.
print
(
"\t"
);
System
.
out
.
print
(
"\t"
);
}
}
}
}
public
static
void
ticket
()
{
public
static
void
ticket
(
String
first
,
String
last
,
String
city
,
String
destination
,
String
section
,
String
reserve
)
{
System
.
out
.
println
(
"END"
);
System
.
out
.
println
(
"Here are your ticket details:"
+
"|{BOARDING PASS}|"
+
"\n Name: "
+
first
+
" "
+
last
+
"\n From: "
+
city
+
"\n To: "
+
destination
+
"\n Flight: "
+
"\n Seat No.: "
+
reserve
+
"\n Section: "
+
section
);
System
.
out
.
println
(
"Thanks for using our booking service"
);
display
(
plane
);
}
}
}
}
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