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
a96f5caf
Commit
a96f5caf
authored
Nov 03, 2019
by
User
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixes
parent
2ea5faf1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
5 deletions
+14
-5
reservation.java
src/airlinereservation/reservation.java
+14
-5
No files found.
src/airlinereservation/reservation.java
View file @
a96f5caf
...
@@ -6,7 +6,7 @@ public class reservation {
...
@@ -6,7 +6,7 @@ public class reservation {
Scanner
input
=
new
Scanner
(
System
.
in
);
Scanner
input
=
new
Scanner
(
System
.
in
);
int
choice
=
0
;
int
choice
=
0
;
String
reserve
=
""
;
String
reserve
=
""
;
String
plane
[][]
=
{{
"XX"
,
"
02
"
,
"XX"
},
{
"04"
,
"05"
,
"06"
},
{
"07"
,
"08"
,
"09"
},
//initialise the array which contains the plane seats
String
plane
[][]
=
{{
"XX"
,
"
XX
"
,
"XX"
},
{
"04"
,
"05"
,
"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"
},
{
"19"
,
"20"
,
"21"
},
{
"22"
,
"23"
,
"24"
},
{
"25"
,
"26"
,
"27"
},
{
"19"
,
"20"
,
"21"
},
{
"22"
,
"23"
,
"24"
},
{
"25"
,
"26"
,
"27"
},
{
"28"
,
"29"
,
"30"
},
{
"31"
,
"32"
,
"33"
},
{
"34"
,
"35"
,
"36"
},
{
"28"
,
"29"
,
"30"
},
{
"31"
,
"32"
,
"33"
},
{
"34"
,
"35"
,
"36"
},
...
@@ -59,11 +59,10 @@ public class reservation {
...
@@ -59,11 +59,10 @@ public class reservation {
reserve
=
input
.
next
();
reserve
=
input
.
next
();
for
(
int
s
=
0
;
s
<
1
;
s
++)
{
for
(
int
s
=
0
;
s
<
1
;
s
++)
{
for
(
int
r
=
0
;
r
<
3
;
r
++)
{
for
(
int
r
=
0
;
r
<
3
;
r
++)
{
System
.
out
.
println
(
plane
[
s
][
r
]
+
reserve
);
if
(
reserve
.
equals
(
plane
[
s
][
r
]))
{
if
(
plane
[
s
][
r
]
==
reserve
)
{
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"
;
display
(
plane
);
ticket
(
);
return
;
return
;
}
}
}
}
...
@@ -85,7 +84,17 @@ public class reservation {
...
@@ -85,7 +84,17 @@ public class reservation {
System
.
out
.
println
(
"Sorry there is no available seat at the moment. The next flight is in 6 hours"
);
System
.
out
.
println
(
"Sorry there is no available seat at the moment. The next flight is in 6 hours"
);
return
;
return
;
case
"Y"
:
case
"Y"
:
System
.
out
.
println
(
"ok"
);
for
(
int
s
=
6
;
s
<
30
;
s
++)
{
for
(
int
r
=
0
;
r
<
3
;
r
++)
{
if
(
plane
[
s
][
r
]
!=
"XX"
)
{
reserve
=
plane
[
s
][
r
];
plane
[
s
][
r
]
=
"XX"
;
System
.
out
.
println
(
"Your booked seat is "
+
reserve
);
ticket
();
return
;
}
}
}
return
;
return
;
default
:
default
:
System
.
out
.
println
(
"invalid input please choose Y or N"
);
System
.
out
.
println
(
"invalid input please choose Y or N"
);
...
...
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