Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
L
Lab7
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
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
9731050
Lab7
Commits
ead03680
Commit
ead03680
authored
May 01, 2019
by
9731050
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
4th
parent
66067b28
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
0 deletions
+27
-0
Airplane.java
src/com/TicketManagement/Airplane.java
+27
-0
No files found.
src/com/TicketManagement/Airplane.java
View file @
ead03680
...
@@ -2,6 +2,11 @@ package com.TicketManagement;
...
@@ -2,6 +2,11 @@ package com.TicketManagement;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
/**
* this class is airplane class and airplane are collaborated
* with seat and flight classes directly
* @author Mohammad Kazemi
*/
public
class
Airplane
{
public
class
Airplane
{
private
String
model
;
private
String
model
;
private
ArrayList
<
Seat
>
seats
;
private
ArrayList
<
Seat
>
seats
;
...
@@ -12,23 +17,45 @@ public class Airplane {
...
@@ -12,23 +17,45 @@ public class Airplane {
freeSeats
=
new
ArrayList
<>();
freeSeats
=
new
ArrayList
<>();
}
}
/**
*
* @return the model of airplane
*/
public
String
getModel
()
{
public
String
getModel
()
{
return
model
;
return
model
;
}
}
/**
* this method adds seat to the airplane
* @param seat
*/
public
void
addSeat
(
Seat
seat
){
public
void
addSeat
(
Seat
seat
){
seats
.
add
(
seat
);
seats
.
add
(
seat
);
freeSeats
.
add
(
seat
);
freeSeats
.
add
(
seat
);
}
}
/**
*
* @return airplane seats
*/
public
ArrayList
<
Seat
>
getseats
(){
return
seats
;}
public
ArrayList
<
Seat
>
getseats
(){
return
seats
;}
/**
* this method reserve a seat for passenger
* @param seat
* @param passenger
*/
public
void
reserveSeat
(
Seat
seat
,
Passenger
passenger
){
public
void
reserveSeat
(
Seat
seat
,
Passenger
passenger
){
if
(
seats
.
contains
(
seat
))
{
if
(
seats
.
contains
(
seat
))
{
freeSeats
.
remove
(
seat
);
freeSeats
.
remove
(
seat
);
seat
.
setUser
(
passenger
);
seat
.
setUser
(
passenger
);
}
}
}
}
/**
*
* @return empty seats airplane
*/
public
ArrayList
<
Seat
>
getFreeSeats
(){
return
freeSeats
;}
public
ArrayList
<
Seat
>
getFreeSeats
(){
return
freeSeats
;}
}
}
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