-
Notifications
You must be signed in to change notification settings - Fork 0
/
amsEconomySEATS.java
56 lines (46 loc) · 1.39 KB
/
amsEconomySEATS.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
package amsSystem;
public class amsEconomySEATS extends amsFlightCode{
//Class and Methods for all Economy Seats on the Flight
private long availableSeats;
private long seatCapacity;
private double price;
public amsEconomySEATS() {
this.availableSeats = 0;
this.seatCapacity = 0;
this.price = 0.0;
}
public amsEconomySEATS(long availableSeats, long seatCapacity, double price){
this.availableSeats = availableSeats;
this.seatCapacity = seatCapacity;
this.price = price;
}
public long getAvailableEconomySeats() {
return availableSeats;
}
public long getEconomySeatCapacity() {
return seatCapacity;
}
public void setAvailableEconomySeats(long availableSeats) {
if (availableSeats <= 0) {
System.out.println("Invalid");
} else {
this.availableSeats = availableSeats;
}
}
public void setEconomySeatCapacity(long seatCapacity) {
if (seatCapacity <= 0 || seatCapacity < availableSeats){
System.out.println("Invalid");
}
this.seatCapacity = seatCapacity;
}
public double getEconomyPrice() {
return price;
}
public void setEconomyPrice(double price) {
if (price < 0.0) {
System.out.println("Invalid");
} else {
this.price = price;
}
}
}