-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDrink.java
43 lines (35 loc) · 834 Bytes
/
Drink.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
package restaurant;
public class Drink {
// Define enum for type to choose easily
public enum Type {
HOT_DRINK,
ICE_DRINK
}
// Define private fields
private Type type;
private String name;
private double price;
private static int totalSales;
// Define constructor
public Drink(Type type, String name, double price) {
this.type = type;
this.name = name;
this.price = price;
}
// Getters and setters for private fields
public Type getType() {
return type;
}
public String getName() {
return name;
}
public double getPrice() {
return price;
}
public static int getTotalSales() {
return totalSales;
}
public static void incrementTotalSales() {
totalSales++;
}
}