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
mrsl2000
lab7
Commits
73890f6c
Commit
73890f6c
authored
Apr 29, 2019
by
mrsl2000
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
oh god javadoc
parents
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
297 additions
and
0 deletions
+297
-0
Flight.java
src/Alibaba/Flight.java
+141
-0
Plane.java
src/Alibaba/Plane.java
+83
-0
Seat.java
src/Alibaba/Seat.java
+73
-0
No files found.
src/Alibaba/Flight.java
0 → 100644
View file @
73890f6c
package
Alibaba
;
import
Alibaba.*
;
/**
* flight class is class that simulate the flight information
* @author mohammadreza
* @version 1.0
*/
public
class
Flight
{
private
String
day
;
private
int
hour
;
private
String
I
;
// starting point
private
String
F
;
// finishing point
private
String
company
;
private
Plane
plane
;
private
int
number
;
public
Flight
(
String
day
,
int
hour
,
String
I
,
String
F
,
String
company
,
Plane
plane
,
int
number
)
{
super
();
this
.
day
=
day
;
this
.
hour
=
hour
;
this
.
I
=
I
;
this
.
F
=
F
;
this
.
company
=
company
;
this
.
plane
=
plane
;
this
.
number
=
number
;
}
/**
* This is a getter method!
* @author mohammadreza
* @return the day
*/
public
String
getDay
()
{
return
day
;
}
/**
* this is a setter method
* @author mohammadreza
* @param day the day to set
*/
public
void
setDay
(
String
day
)
{
this
.
day
=
day
;
}
/**
* This is a getter method!
* @author mohammadreza
* @return the hour
*/
public
int
getHour
()
{
return
hour
;
}
/**
* this is a setter method
* @author mohammadreza
* @param hour the hour to set
*/
public
void
setHour
(
int
hour
)
{
this
.
hour
=
hour
;
}
/**
* This is a getter method!
* @author mohammadreza
* @return the i
*/
public
String
getI
()
{
return
I
;
}
/**
* this is a setter method
* @author mohammadreza
* @param i the i to set
*/
public
void
setI
(
String
i
)
{
I
=
i
;
}
/**
* This is a getter method!
* @author mohammadreza
* @return the f
*/
public
String
getF
()
{
return
F
;
}
/**
* this is a setter method
* @author mohammadreza
* @param f the f to set
*/
public
void
setF
(
String
f
)
{
F
=
f
;
}
/**
* This is a getter method!
* @author mohammadreza
* @return the company
*/
public
String
getCompany
()
{
return
company
;
}
/**
* this is a setter method
* @author mohammadreza
* @param company the company to set
*/
public
void
setCompany
(
String
company
)
{
this
.
company
=
company
;
}
/**
* This is a getter method!
* @author mohammadreza
* @return the plane
*/
public
Plane
getPlane
()
{
return
plane
;
}
/**
* this is a setter method
* @author mohammadreza
* @param plane the plane to set
*/
public
void
setPlane
(
Plane
plane
)
{
this
.
plane
=
plane
;
}
/**
* This is a getter method!
* @author mohammadreza
* @return the number
*/
public
int
getNumber
()
{
return
number
;
}
/**
* this is a setter method
* @author mohammadreza
* @param number the number to set
*/
public
void
setNumber
(
int
number
)
{
this
.
number
=
number
;
}
}
src/Alibaba/Plane.java
0 → 100644
View file @
73890f6c
package
Alibaba
;
import
Alibaba.*
;
import
java.util.ArrayList
;
/**
* this class is a simulation of airplane and the seats of it
* @author mohammadreza
* @version 1.0
*/
public
class
Plane
{
private
String
type
;
private
ArrayList
<
Seat
>
seats
;
/**
* This is a getter method!
* @author mohammadreza
* @return the type
*/
public
String
getType
()
{
return
type
;
}
/**
* this is a setter method
* @author mohammadreza
* @param type the type to set
*/
public
void
setType
(
String
type
)
{
this
.
type
=
type
;
}
/**
* This is a getter method!
* @author mohammadreza
* @return the seats
*/
public
ArrayList
<
Seat
>
getSeats
()
{
return
seats
;
}
/**
* this is a setter method
* @author mohammadreza
* @param seats the seats to set
*/
public
void
setSeats
(
ArrayList
<
Seat
>
seats
)
{
this
.
seats
=
seats
;
}
public
Plane
(
String
type
,
int
ecoNum
,
int
firstnum
,
int
businessNum
){
setType
(
type
);
seats
=
new
ArrayList
<>();
for
(
int
i
=
0
;
i
<
ecoNum
+
firstnum
+
businessNum
;
i
++){
if
(
i
<
ecoNum
){
Seat
s
=
new
Seat
(
i
,
"eco"
);
seats
.
add
(
s
);
}
else
if
(
i
<
ecoNum
+
firstnum
){
Seat
s
=
new
Seat
(
i
,
"firstClass"
);
seats
.
add
(
s
);
}
else
{
Seat
s
=
new
Seat
(
i
,
"business"
);
seats
.
add
(
s
);
}
}
}
/**
* showAllSeats show us the every seats in plane
* @author mohammadreza
*/
public
void
showAllSeats
(){
for
(
Seat
s
:
seats
)
{
java
.
lang
.
System
.
out
.
println
(
s
.
getNum
()+
","
+
s
.
getType
());
}
}
/**
* showFreeSeats show user were he can sit
* @author mohammadreza
*/
public
void
showFreeSeats
(){
for
(
Seat
s
:
seats
)
{
if
(!
s
.
getDiscription
())
java
.
lang
.
System
.
out
.
println
(
s
.
getNum
()+
","
+
s
.
getType
());
}
}
}
src/Alibaba/Seat.java
0 → 100644
View file @
73890f6c
package
Alibaba
;
/**
* this class modeling seats in the airplane
* @author mohammadreza
* @version 1.0
*/
public
class
Seat
{
private
boolean
discription
;
// seat is free or reserved
private
String
type
;
private
int
num
;
/**
* @author mohammadreza
* @param discription is false at the first
* @param type is first class or not
* @param num to set the number of seat
*/
public
Seat
(
String
type
,
int
num
)
{
this
.
discription
=
false
;
//free
this
.
type
=
type
;
this
.
num
=
num
;
}
/**
* This is a getter method!
* @author mohammadreza
* @return the discription
*/
public
boolean
isDiscription
()
{
return
discription
;
}
/**
* this is a setter method
* @author mohammadreza
* @param discription the discription to set
*/
public
void
setDiscription
(
boolean
discription
)
{
this
.
discription
=
discription
;
}
/**
* This is a getter method!
* @author mohammadreza
* @return the type
*/
public
String
getType
()
{
return
type
;
}
/**
* this is a setter method
* @author mohammadreza
* @param type the type to set
*/
public
void
setType
(
String
type
)
{
this
.
type
=
type
;
}
/**
* This is a getter method!
* @author mohammadreza
* @return the num
*/
public
int
getNum
()
{
return
num
;
}
/**
* this is a setter method
* @author mohammadreza
* @param num the num to set
*/
public
void
setNum
(
int
num
)
{
this
.
num
=
num
;
}
}
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