-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathamsFlightPackage.java
119 lines (87 loc) · 3.34 KB
/
amsFlightPackage.java
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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
package amsSystem;
import java.time.LocalDate;
public class amsFlightPackage extends amsFirstClassSeats{ // Class for flight and plane systems of the airline
// All important data needed for each flight
private long flightNumber;
private String flightModel;
private String flightStartingLocation;
private String departureTime;
private String flightDestination;
private String arrivalTime;
private LocalDate departureDate;
// Primary Constructor for every Flight
public amsFlightPackage() {
this.flightNumber = 0;
this.flightModel = "";
this.flightStartingLocation = "";
this.departureTime = "";
this.flightDestination = "";
this.arrivalTime = "";
this.departureDate = LocalDate.now();
}
//Constructor with Parameters
public amsFlightPackage(long flightNumber, String flightModel, String flightStartingLocation, String departureTime, String flightDestination, String arrivalTime, LocalDate departureDate) {
this.flightNumber = flightNumber;
this.flightModel = flightModel;
this.flightStartingLocation = flightStartingLocation;
this.departureTime = departureTime;
this.flightDestination = flightDestination;
this.arrivalTime = arrivalTime;
this.departureDate = departureDate;
}
// All Accessors Methods(Getters) and Mutator Methods(Setters)
public long getFlightNumber() {
return flightNumber;
}
public void setFlightNumber(long flightNumber) {
if (flightNumber <= 0) {
System.out.println("Invalid Flight Number, Please Try Again");
} else {
this.flightNumber = flightNumber;
}
}
public String getFlightModel() {
return flightModel;
}
public void setFlightModel(String flightModel) {
this.flightModel = flightModel;
}
public String getFlightStartingLocation() {
return flightStartingLocation;
}
public void setFlightStartingLocation(String flightStartingLocation) {
this.flightStartingLocation = flightStartingLocation;
}
public String getDepartureTime() {
return departureTime;
}
public void setDepartureTime(String departureTime) {
this.departureTime = departureTime;
}
public String getFlightDestination() {
return flightDestination;
}
public void setFlightDestination(String flightDestination) {
this.flightDestination = flightDestination;
}
public String getArrivalTime() {
return arrivalTime;
}
public void setArrivalTime(String arrivalTime) {
this.arrivalTime = arrivalTime;
}
public LocalDate getDepartureDate() {
return departureDate;
}
public void setDepartureDate(LocalDate departureDate) {
this.departureDate = departureDate;
}
//Overriding the method so information is easier to read in console for users
@Override
public String toString() {
return "{" + "flightNumber=" + flightNumber + ", flightModel='" + flightModel + '\'' +
", flightStartingLocation='" + flightStartingLocation + '\'' +
", flightDestination='" + flightDestination + '\'' + ", departureTime='" + departureTime + '\'' +
", arrivalTime='" + arrivalTime + '\'' + "departureDate=" + departureDate + '}';
}
}