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
alexandru.radulescu
AirlineReservation
Commits
f85e03bc
Commit
f85e03bc
authored
Oct 29, 2019
by
alexandru.radulesc
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added an attempt of looping doesn't work
parent
942b82f1
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
7 deletions
+16
-7
Yeyey1.java
src/Yeyey1.java
+16
-7
No files found.
src/Yeyey1.java
View file @
f85e03bc
...
...
@@ -3,7 +3,6 @@ import java.util.Scanner;
public
class
Yeyey1
{
//--------------------------------------------------Setup Phase--------------------------------------------------\\
static
Scanner
input
=
new
Scanner
(
System
.
in
);
//We're just setting up the input for now;
static
String
[]
seat
=
new
String
[
100
];
static
int
j
=
0
,
k
=
0
,
mainSeatNumber
=
0
,
classRead
;
...
...
@@ -24,6 +23,9 @@ public class Yeyey1 {
ShowSeats
();
while
(
classRead
!=
4
)
{
System
.
out
.
println
(
"For First Class please input 1"
);
System
.
out
.
println
(
"For Business Class please input 2"
);
System
.
out
.
println
(
"For Economy Class please input 3"
);
...
...
@@ -32,6 +34,7 @@ public class Yeyey1 {
BookSeats
(
classRead
);
ShowSeats
();
}
}
...
...
@@ -42,24 +45,21 @@ public class Yeyey1 {
{
System
.
out
.
println
(
"Please select a seat from 01 to 18"
);
{
mainSeatNumber
=
input
.
nextInt
();
seat
[
mainSeatNumber
-
1
]
=
"XX"
;
OccupySeats
();
}
}
else
if
(
mainClass
==
2
)
{
System
.
out
.
println
(
"Please select a seat from 19 to 45"
);
{
mainSeatNumber
=
input
.
nextInt
();
seat
[
mainSeatNumber
-
1
]
=
"XX"
;
OccupySeats
();
}
}
else
if
(
mainClass
==
3
)
{
System
.
out
.
println
(
"Please select a seat from 46 to 90"
);
{
mainSeatNumber
=
input
.
nextInt
();
seat
[
mainSeatNumber
-
1
]
=
"XX"
;
OccupySeats
();
}
}
}
...
...
@@ -114,4 +114,13 @@ public class Yeyey1 {
AssignSeats
(
45
,
90
);
}
public
static
void
OccupySeats
()
{
mainSeatNumber
=
input
.
nextInt
();
if
(
seat
[
mainSeatNumber
]
!=
"XX"
)
{
seat
[
mainSeatNumber
-
1
]
=
"XX"
;
}
else
System
.
out
.
println
(
"Seat is already occupied"
);
}
}
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