-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBeverage.java
55 lines (48 loc) · 1.12 KB
/
Beverage.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
public abstract class Beverage {
private String name;
private TYPE type;
private SIZE size;
private final double BASE_PRICE = 2.0;
private final double SIZE_PRICE = 1.0;
public Beverage(String n, TYPE t, SIZE s) {
name = n;
type = t;
size = s;
}
public abstract double calcPrice();
public String toString() {
return name +", " +size;
}
public boolean equals(Beverage bev) {
if (name.equals(bev.getBevName()) && type==bev.getType() && size==bev.getSize()) {
return true;
}
else {
return false;
}
}
public double getBasePrice() {
return BASE_PRICE;
}
public double getSizePrice() {
return SIZE_PRICE;
}
public String getBevName() {
return name;
}
public TYPE getType() {
return type;
}
public SIZE getSize() {
return size;
}
public void setName(String n) {
name = n;
}
public void setType(TYPE t) {
type = t;
}
public void setSize(SIZE s) {
size = s;
}
}