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
Show 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{
...
@@ -50,32 +50,32 @@ public class reservation{
}
}
if
(
seat
==
true
)
{
//if statement to run code if seat is available
if
(
seat
==
true
)
{
//if statement to run code if seat is available
while
(
true
)
{
//while loop to display options
while
(
true
)
{
//while loop to display options
System
.
out
.
println
(
"Would you like to choose a seat?(Y/N)"
);
System
.
out
.
println
(
"Would you like to choose a seat?(Y/N)"
);
//print out options
String
choose
=
input
.
next
();
String
choose
=
input
.
next
();
//takes in the user input
switch
(
choose
)
{
switch
(
choose
)
{
//switch case for different outcomes
case
"N"
:
case
"N"
:
//if the user types N this code is run
System
.
out
.
println
(
"Ok, You will be assigned the next available seat"
);
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
++)
{
for
(
int
s
=
0
;
s
<
6
;
s
++)
{
//loop to go through the first class seats
for
(
int
r
=
0
;
r
<
3
;
r
++)
{
for
(
int
r
=
0
;
r
<
3
;
r
++)
{
if
(
plane
[
s
][
r
]
!=
"XX"
)
{
if
(
plane
[
s
][
r
]
!=
"XX"
)
{
//searches for the first seat that is NOT EQUAL to XX
reserve
=
plane
[
s
][
r
];
reserve
=
plane
[
s
][
r
];
//sets the users' reserve seat to the array value
plane
[
s
][
r
]
=
"XX"
;
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
);
System
.
out
.
println
(
"Your booked seat is "
+
reserve
);
//prints out booked seat
ticket
(
first
,
last
,
city
,
destination
,
section
,
reserve
);
ticket
(
first
,
last
,
city
,
destination
,
section
,
reserve
);
//calls the ticket function to print out the ticket details
return
;
return
;
}
}
}
}
}
}
return
;
return
;
case
"Y"
:
case
"Y"
:
//if the user types Y this code is run
System
.
out
.
println
(
"Ok please choose a seat:"
System
.
out
.
println
(
"Ok please choose a seat:"
//asks user to choose their seat
+
"\n Here is the plane seat layout"
);
+
"\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: "
);
System
.
out
.
println
(
"\nSeat choice: "
);
reserve
=
input
.
next
();
reserve
=
input
.
next
();
//grabs input from user
if
(
reserve
.
equals
(
"XX"
))
{
if
(
reserve
.
equals
(
"XX"
))
{
//check for if the user types in XX
System
.
out
.
println
(
"Input cannot be XX"
);
System
.
out
.
println
(
"Input cannot be XX"
);
//print out error message
continue
;
continue
;
//skips loop
}
}
for
(
int
s
=
0
;
s
<
6
;
s
++)
{
for
(
int
s
=
0
;
s
<
6
;
s
++)
{
for
(
int
r
=
0
;
r
<
3
;
r
++)
{
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