-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathFirstClassSeat.java
67 lines (56 loc) · 1.69 KB
/
FirstClassSeat.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
/**
* This is a model of first-class seat. Rows 1 thru 6 are First Class
*
* First Class passengers receive a Gourmet meal and have 8 inches of seat recline;
*
* @author Iryna Sherepot
* @version 11/20/18
*/
public class FirstClassSeat extends Seat{
private MealType type;
private double alohaDiscount = 0.1;
private static final MealType MEAL_TYPE = MealType.Gourmet;
private static final int RECLINE_INCH = 8;
private static final double PRICE_MARKUP = 2.00;
/**
* Constructor of First class seat
*
* @row - the row the seat is in. Must be 0 to 5 inclusive
* @col - the column te seat is in. Must be 0 to 4 inclusive.
*/
public FirstClassSeat(Flight myFlight, int row, int col){
super(myFlight, row, col, MEAL_TYPE,RECLINE_INCH);
if(col > 4 || row >5){
throw new IllegalArgumentException("Row/Column numbers beyond first class.First class seats only in a first 6 rows and 4 columns.");
}
}
/**
* Returns seat recline
*
* @return - the amount of inches of recline
*/
public int getRecline(){
return RECLINE_INCH;
}
/**
* Return meal type assigned to seat
*
* @return - first class seat meal type
*/
public MealType getMealType(){
return MEAL_TYPE;
}
/**
* Returns seat price
*
* @return the price of the seat
*/
public double getPrice() {
return (this.getPrice(alohaDiscount) * PRICE_MARKUP);
}
public String toString(){
String info = super.toString();
info += "This seat price is : " + this.getPrice(alohaDiscount);
return info;
}
}