Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
P
project-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
Amirhosein Rajabpour
project-Lab7
Commits
9ac7597c
Commit
9ac7597c
authored
Apr 28, 2019
by
Amirhosein Rajabpour
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
half commit 2
parent
e5464570
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
77 additions
and
61 deletions
+77
-61
Airplane.java
src/com/TicketManagement/Airplane.java
+29
-8
Customer.java
src/com/TicketManagement/Customer.java
+8
-14
Flight.java
src/com/TicketManagement/Flight.java
+14
-6
Seat.java
src/com/TicketManagement/Seat.java
+7
-6
Ticket.java
src/com/TicketManagement/Ticket.java
+18
-11
TicketManagement.java
src/com/TicketManagement/TicketManagement.java
+1
-16
No files found.
src/com/TicketManagement/Airplane.java
View file @
9ac7597c
package
com
.
TicketManagement
;
package
com
.
TicketManagement
;
import
java.util.ArrayList
;
public
class
Airplane
{
public
class
Airplane
{
private
int
seats
;
private
Seat
seat
;
private
String
airplaneagency
;
private
String
airplaneagency
;
public
Airplane
(
int
seats
,
String
airplaneagency
){
private
String
model
;
this
.
seats
=
seats
;
public
Airplane
(
Seat
seat
,
String
airplaneagency
,
String
model
){
this
.
seat
=
seat
;
this
.
airplaneagency
=
airplaneagency
;
this
.
airplaneagency
=
airplaneagency
;
this
.
model
=
model
;
}
}
public
int
getSeats
()
{
return
seats
;
}
public
String
getAirplaneagency
()
{
ArrayList
<
Seat
>
seats
=
new
ArrayList
<>();
return
airplaneagency
;
public
ArrayList
<
Seat
>
getSeats
()
{
return
seats
;
}
public
String
getModel
(){
return
model
;}
public
String
getAirplaneagency
()
{
return
airplaneagency
;
}
public
boolean
reserveSeat
(
Seat
seat
)
{
if
(
seats
.
contains
(
seat
))
{
System
.
out
.
println
(
"seat is reserved"
);
return
false
;
}
else
{
seats
.
add
(
seat
);
return
true
;
}
}
}
}
}
src/com/TicketManagement/Customer.java
View file @
9ac7597c
...
@@ -6,28 +6,22 @@ public class Customer {
...
@@ -6,28 +6,22 @@ public class Customer {
private
String
name
,
lastname
;
private
String
name
,
lastname
;
private
int
ID
;
private
int
ID
;
private
ArrayList
<
Ticket
>
tickets
=
new
ArrayList
<
Ticket
>();
private
ArrayList
<
Ticket
>
tickets
=
new
ArrayList
<
Ticket
>();
public
Customer
(
String
name
,
String
lastname
,
int
ID
){
public
Customer
(
String
name
,
String
lastname
,
int
ID
){
this
.
name
=
name
;
this
.
name
=
name
;
this
.
ID
=
ID
;
this
.
ID
=
ID
;
this
.
lastname
=
lastname
;
this
.
lastname
=
lastname
;
}
}
public
void
addTicket
(
Ticket
ticket
){
tickets
.
add
(
ticket
);
}
public
ArrayList
<
Ticket
>
getTickets
()
{
public
int
getID
()
{
return
ID
;
}
return
tickets
;
}
public
int
getID
()
{
public
String
getName
()
{
return
name
;
}
return
ID
;
}
public
String
getName
()
{
public
String
getLastname
()
{
return
lastname
;
}
return
name
;
}
public
String
getLastname
()
{
public
void
addTicket
(
Ticket
t
){
tickets
.
add
(
t
);
return
lastname
;
t
.
getFlight
().
getAirplane
().
reserveSeat
(
t
.
getSeat
)
;
}
}
}
}
src/com/TicketManagement/Flight.java
View file @
9ac7597c
...
@@ -7,21 +7,27 @@ public class Flight {
...
@@ -7,21 +7,27 @@ public class Flight {
private
String
destination
;
private
String
destination
;
private
Airplane
airplane
;
private
Airplane
airplane
;
private
int
flightNumber
;
private
int
flightNumber
;
private
String
start
;
private
String
source
;
public
Flight
(
Date
date
,
int
flightNumber
,
String
destination
,
String
start
,
Airplane
airplane
){
private
String
company
;
private
String
model
;
public
Flight
(
Date
date
,
int
flightNumber
,
String
destination
,
String
source
,
Airplane
airplane
){
this
.
date
=
date
;
this
.
date
=
date
;
this
.
s
tart
=
start
;
this
.
s
ource
=
source
;
this
.
airplane
=
airplane
;
this
.
airplane
=
airplane
;
this
.
destination
=
destination
;
this
.
destination
=
destination
;
this
.
flightNumber
=
flightNumber
;
this
.
flightNumber
=
flightNumber
;
this
.
company
=
airplane
.
getAirplaneagency
();
this
.
model
=
airplane
.
getModel
();
}
}
public
int
getFlightNumber
()
{
public
int
getFlightNumber
()
{
return
flightNumber
;
return
flightNumber
;
}
}
public
String
getS
tart
()
{
public
String
getS
ource
()
{
return
s
tart
;
return
s
ource
;
}
}
public
Airplane
getAirplane
()
{
public
Airplane
getAirplane
()
{
return
airplane
;
return
airplane
;
}
}
...
@@ -30,9 +36,11 @@ public class Flight {
...
@@ -30,9 +36,11 @@ public class Flight {
return
date
;
return
date
;
}
}
public
String
getDestination
()
{
public
String
getDestination
()
{
return
destination
;
return
destination
;
}
}
public
String
getCompany
(){
return
company
;}
}
}
src/com/TicketManagement/Seat.java
View file @
9ac7597c
...
@@ -2,22 +2,23 @@ package com.TicketManagement;
...
@@ -2,22 +2,23 @@ package com.TicketManagement;
public
class
Seat
{
public
class
Seat
{
private
int
ID
;
private
int
ID
;
private
String
kind
;
private
String
Type
;
private
int
userID
;
private
int
userID
;
public
Seat
(
int
ID
,
String
kind
,
int
userID
){
public
Seat
(
int
ID
,
String
Type
){
this
.
kind
=
kind
;
this
.
Type
=
Type
;
this
.
ID
=
ID
;
this
.
ID
=
ID
;
this
.
userID
=
userID
;
}
}
public
int
getID
()
{
public
int
getID
()
{
return
ID
;
return
ID
;
}
}
public
String
get
Kind
()
{
public
String
get
Type
()
{
return
kind
;
return
Type
;
}
}
public
int
getUserID
(){
return
userID
;}
public
int
getUserID
(){
return
userID
;}
public
void
setUser
(
int
u
)
{
userID
=
u
;
}
}
}
src/com/TicketManagement/Ticket.java
View file @
9ac7597c
...
@@ -3,21 +3,24 @@ package com.TicketManagement;
...
@@ -3,21 +3,24 @@ package com.TicketManagement;
public
class
Ticket
{
public
class
Ticket
{
private
int
seatnumber
;
private
int
seatnumber
;
private
int
flightnumber
;
private
int
flightnumber
;
private
int
cargo
;
private
int
LuggageWeight
;
private
String
meal
;
private
String
food
;
public
Ticket
(
int
seatnumber
,
int
flightnumber
,
int
cargo
,
String
meal
){
Flight
flight
;
this
.
flightnumber
=
flightnumber
;
Seat
seat
;
this
.
seatnumber
=
seatnumber
;
this
.
cargo
=
cargo
;
public
Ticket
(
Seat
seat
,
Flight
flight
,
int
LuggageWeight
,
String
food
){
this
.
meal
=
meal
;
this
.
flightnumber
=
flight
.
getFlightNumber
();
this
.
seatnumber
=
seat
.
getID
();
this
.
LuggageWeight
=
LuggageWeight
;
this
.
food
=
food
;
}
}
public
int
get
Cargo
()
{
public
int
get
LuggageWeight
()
{
return
cargo
;
return
LuggageWeight
;
}
}
public
String
get
Meal
()
{
public
String
get
Food
()
{
return
meal
;
return
food
;
}
}
public
int
getFlightnumber
()
{
public
int
getFlightnumber
()
{
...
@@ -27,4 +30,8 @@ public class Ticket {
...
@@ -27,4 +30,8 @@ public class Ticket {
public
int
getSeatnumber
()
{
public
int
getSeatnumber
()
{
return
seatnumber
;
return
seatnumber
;
}
}
public
Flight
getFlight
()
{
return
flight
;}
public
Seat
getSeat
(){
return
seat
;}
}
}
src/com/TicketManagement/TicketManagement.java
View file @
9ac7597c
...
@@ -4,26 +4,11 @@ import java.util.ArrayList;
...
@@ -4,26 +4,11 @@ import java.util.ArrayList;
public
class
TicketManagement
{
public
class
TicketManagement
{
private
ArrayList
<
Flight
>
flights
=
new
ArrayList
<
Flight
>();
private
ArrayList
<
Flight
>
flights
=
new
ArrayList
<
Flight
>();
private
ArrayList
<
Customer
>
customers
=
new
ArrayList
<
Customer
>();
private
ArrayList
<
Airplane
>
airplanes
=
new
ArrayList
<
Airplane
>();
public
ArrayList
<
Flight
>
getFlights
()
{
public
ArrayList
<
Flight
>
getFlights
()
{
return
flights
;
return
flights
;
}
}
public
void
removeFlight
(
Flight
flight
){
flights
.
remove
(
flight
);}
public
ArrayList
<
Customer
>
getCustomers
()
{
return
customers
;
}
public
ArrayList
<
Airplane
>
getAirplanes
()
{
return
airplanes
;
}
public
void
addAirplane
(
Airplane
airplane
){
airplanes
.
add
(
airplane
);
}
public
void
addCustomer
(
Customer
customer
){
customers
.
add
(
customer
);
}
public
void
addFlight
(
Flight
flight
){
public
void
addFlight
(
Flight
flight
){
flights
.
add
(
flight
);
flights
.
add
(
flight
);
}
}
...
...
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