-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFlight.java
More file actions
84 lines (68 loc) · 2.2 KB
/
Copy pathFlight.java
File metadata and controls
84 lines (68 loc) · 2.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
import java.util.ArrayList;
import java.util.UUID;
/**
* Class to manage a flight
* @author Benjamin Singleton
*/
class Flight {
private UUID flightID;
private String deptAirportCode;
private String arrivAirportCode;
private Plane plane;
private double price;
private Reservation flightReservation;
private ArrayList<Seat> userSeats = new ArrayList<>();
// private ArrayList<PartyMember> partyMembers = new ArrayList<>();
public Flight(UUID flightID, String deptAirportCode, String arrivAirportCode, Plane plane, double price,
Reservation flightReservation) {
this.flightID = flightID;
this.deptAirportCode = deptAirportCode;
this.arrivAirportCode = arrivAirportCode;
this.plane = plane;
this.price = price;
this.flightReservation = flightReservation;
}
//Getters
public UUID getFlightID() {
return flightID;
}
public String getDeptAirportCode() {
return deptAirportCode;
}
public String getArrivAirportCode() {
return arrivAirportCode;
}
public Plane getPlane() {
return plane;
}
public double getPrice() {
return price;
}
public Reservation getFlightReservation() {
return flightReservation;
}
public ArrayList<Seat> getUserSeats() {
return userSeats;
}
public void addUserSeat(Seat userSeat) {
userSeats.add(userSeat);
}
public boolean checkFlight(String deptAirportCode, String arrivAirportCode, Date deptDate) {
return deptAirportCode.equalsIgnoreCase(this.deptAirportCode) && arrivAirportCode.equalsIgnoreCase(this.arrivAirportCode)
&& deptDate.checkDate(flightReservation.getStartDate());
}
public void updateSeat(Seat userSeat) {
plane.updateSeat(userSeat);
}
public String getSeatChart() {
return plane.displayAll();
}
public String toString() {
return "Departing From: " + deptAirportCode
+ "\nHeading to: " + arrivAirportCode
+ "\nPrice: " + price + "\n" + flightReservation.toString();
}
public void setUserSeats(ArrayList<Seat> userSeats) {
this.userSeats = userSeats;
}
}