Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
airline booking system
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
quinn.haigh
airline booking system
Commits
7be967a6
Commit
7be967a6
authored
Nov 04, 2019
by
quinn.haigh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
first commit
parents
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
208 additions
and
0 deletions
+208
-0
.classpath
flightrepository/.classpath
+6
-0
.gitignore
flightrepository/.gitignore
+1
-0
.project
flightrepository/.project
+17
-0
org.eclipse.jdt.core.prefs
flightrepository/.settings/org.eclipse.jdt.core.prefs
+11
-0
repository.java
flightrepository/src/flightrepository/repository.java
+173
-0
No files found.
flightrepository/.classpath
0 → 100644
View file @
7be967a6
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry
kind=
"con"
path=
"org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"
/>
<classpathentry
kind=
"src"
path=
"src"
/>
<classpathentry
kind=
"output"
path=
"bin"
/>
</classpath>
flightrepository/.gitignore
0 → 100644
View file @
7be967a6
/bin/
flightrepository/.project
0 → 100644
View file @
7be967a6
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>
flightrepository
</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>
org.eclipse.jdt.core.javabuilder
</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>
org.eclipse.jdt.core.javanature
</nature>
</natures>
</projectDescription>
flightrepository/.settings/org.eclipse.jdt.core.prefs
0 → 100644
View file @
7be967a6
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.8
flightrepository/src/flightrepository/repository.java
0 → 100644
View file @
7be967a6
package
flightrepository
;
//import scanner to be able use scanner
import
java.util.Scanner
;
public
class
repository
{
// List of all Static variables
public
static
Scanner
input
=
new
Scanner
(
System
.
in
);
public
static
int
numberAssigner
=
1
;
public
static
int
userInput
;
public
static
String
selectSeat
;
public
static
boolean
seatTaken
=
false
;
public
static
String
name
;
public
static
String
originDestination
;
public
static
String
destination
;
public
static
int
flightNum
=
01
;
//setting boundaries and names of the arrays
public
static
String
[][]
first_class
=
new
String
[
9
][
2
];
public
static
String
[][]
business_class
=
new
String
[
9
][
3
];
public
static
String
[][]
economy_class
=
new
String
[
9
][
5
];
//setting main method
public
static
void
main
(
String
[]
args
)
{
//populating seating classes
populateSeatNum
(
first_class
);
populateSeatNum
(
business_class
);
populateSeatNum
(
economy_class
);
menuChoice
();
}
//function for generating boarding pass
public
static
void
boardingPass
()
{
System
.
out
.
println
(
"|[ BOARDING PASS ]|"
);
System
.
out
.
println
(
"name :"
+
name
);
System
.
out
.
println
(
"From :"
+
originDestination
);
System
.
out
.
println
(
"To :"
+
destination
);
System
.
out
.
println
(
"Flight :"
+
flightNum
);
System
.
out
.
println
(
"Seat No :"
+
selectSeat
);
System
.
out
.
println
(
"Section :FL"
+
flightNum
);
flightNum
++;
}
//function for assigning seat
public
static
void
chooseSeat
(
String
[][]
seats
)
{
System
.
out
.
println
(
"Enter seat you wish to book > "
);
selectSeat
=
input
.
next
();
for
(
int
i
=
0
;
i
<
seats
[
0
].
length
;
i
++)
{
if
(
seatTaken
==
true
)
{
break
;
}
for
(
int
j
=
0
;
j
<
seats
.
length
;
j
++)
{
// Assign seat if free
if
(
selectSeat
.
equals
(
seats
[
j
][
i
]))
{
seats
[
j
][
i
]
=
"XX"
;
seatTaken
=
true
;
if
(
seatTaken
==
true
)
{
System
.
out
.
println
(
"Seat "
+
selectSeat
+
" booked"
);
boardingPass
();
break
;
}
classAssigner
(
seats
);
}
}
}
}
//Assigning the seats in each class type array
public
static
void
assignSeat
(
String
[][]
seatAssign
)
{
for
(
int
column
=
0
;
column
<
seatAssign
[
0
].
length
;
column
++)
{
for
(
int
row
=
0
;
row
<
seatAssign
.
length
;
row
++)
{
seatAssign
[
row
][
column
]
=
Integer
.
toString
(
numberAssigner
);
numberAssigner
++;
}
}
}
//setting up the main menu
public
static
void
menuChoice
()
{
//collecting details of customer for baording pass
System
.
out
.
println
(
"Please enter name > "
);
name
=
input
.
next
();
System
.
out
.
println
(
"City of Origin > "
);
originDestination
=
input
.
next
();
System
.
out
.
println
(
"Destination travelling to > "
);
destination
=
input
.
next
();
//menu for classes
System
.
out
.
println
(
"please choose which class you would like,\n"
+
"1 for first class,\n"
+
"2 for business class, \n"
+
"3 for economy class, \n "
);
int
customerChoice
=
input
.
nextInt
();
switch
(
customerChoice
)
{
case
1
:
classAssigner
(
first_class
);
break
;
case
2
:
classAssigner
(
business_class
);
break
;
case
3
:
classAssigner
(
economy_class
);
}
}
// assign and create seat charts for each class
public
static
void
classAssigner
(
String
[][]
assignClass
)
{
int
counter
=
1
;
for
(
int
column
=
0
;
column
<
assignClass
[
0
].
length
;
column
++)
{
counter
=
1
;
for
(
int
row
=
0
;
row
<
assignClass
.
length
;
row
++)
{
if
(
counter
>
3
)
{
System
.
out
.
print
(
" "
+
"["
+
assignClass
[
row
][
column
]
+
"]"
+
""
);
counter
=
1
;
}
else
{
System
.
out
.
print
(
"["
+
assignClass
[
row
][
column
]
+
"]"
+
""
);
}
counter
++;
}
System
.
out
.
println
();
}
chooseSeat
(
assignClass
);
}
//Initialize 2-D array which is called seatAssign
public
static
void
populateSeatNum
(
String
[][]
seatAssign
)
{
for
(
int
column
=
0
;
column
<
seatAssign
[
0
].
length
;
column
++)
{
for
(
int
row
=
0
;
row
<
seatAssign
.
length
;
row
++)
{
seatAssign
[
row
][
column
]
=
Integer
.
toString
(
numberAssigner
);
numberAssigner
++;
}
}
}
}
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