Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
Airline Reservation Final
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
Airline Reservation Final
Commits
cf41296c
Commit
cf41296c
authored
Nov 04, 2019
by
User
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
comments
parent
6605f01f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
18 deletions
+18
-18
reservation.java
src/ar/reservation.java
+18
-18
No files found.
src/ar/reservation.java
View file @
cf41296c
...
...
@@ -50,32 +50,32 @@ public class reservation{
}
if
(
seat
==
true
)
{
//if statement to run code if seat is available
while
(
true
)
{
//while loop to display options
System
.
out
.
println
(
"Would you like to choose a seat?(Y/N)"
);
String
choose
=
input
.
next
();
switch
(
choose
)
{
case
"N"
:
System
.
out
.
println
(
"Ok, You will be assigned the next available seat"
);
for
(
int
s
=
0
;
s
<
6
;
s
++)
{
System
.
out
.
println
(
"Would you like to choose a seat?(Y/N)"
);
//print out options
String
choose
=
input
.
next
();
//takes in the user input
switch
(
choose
)
{
//switch case for different outcomes
case
"N"
:
//if the user types N this code is run
System
.
out
.
println
(
"Ok, You will be assigned the next available seat"
);
//user informed that they are given the next available seat
for
(
int
s
=
0
;
s
<
6
;
s
++)
{
//loop to go through the first class seats
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
(
first
,
last
,
city
,
destination
,
section
,
reserve
);
if
(
plane
[
s
][
r
]
!=
"XX"
)
{
//searches for the first seat that is NOT EQUAL to XX
reserve
=
plane
[
s
][
r
];
//sets the users' reserve seat to the array value
plane
[
s
][
r
]
=
"XX"
;
//sets the seat to XX so that it can't be double booked
System
.
out
.
println
(
"Your booked seat is "
+
reserve
);
//prints out booked seat
ticket
(
first
,
last
,
city
,
destination
,
section
,
reserve
);
//calls the ticket function to print out the ticket details
return
;
}
}
}
return
;
case
"Y"
:
System
.
out
.
println
(
"Ok please choose a seat:"
case
"Y"
:
//if the user types Y this code is run
System
.
out
.
println
(
"Ok please choose a seat:"
//asks user to choose their seat
+
"\n Here is the plane seat layout"
);
display
(
plane
);
display
(
plane
);
//calls display function to print out plane seat layout
System
.
out
.
println
(
"\nSeat choice: "
);
reserve
=
input
.
next
();
if
(
reserve
.
equals
(
"XX"
))
{
System
.
out
.
println
(
"Input cannot be XX"
);
continue
;
reserve
=
input
.
next
();
//grabs input from user
if
(
reserve
.
equals
(
"XX"
))
{
//check for if the user types in XX
System
.
out
.
println
(
"Input cannot be XX"
);
//print out error message
continue
;
//skips loop
}
for
(
int
s
=
0
;
s
<
6
;
s
++)
{
for
(
int
r
=
0
;
r
<
3
;
r
++)
{
...
...
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