-
Notifications
You must be signed in to change notification settings - Fork 0
/
Food.java
55 lines (46 loc) · 1.09 KB
/
Food.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
package restaurant;
public class Food {
// Define enum for type and mealtime to choose easily
public enum Type {
FAST_FOOD,
IRANIAN_FOOD,
CHINESE_FOOD
}
public enum MealTime {
BREACK_FAST,
LUNCH,
DINNER
}
// Determin field of food class
private Type type;
private String name;
private double price;
private MealTime mealTime;
private static int totalSales;
// Define constructor
public Food(Type type, String name, double price, MealTime mealTime) {
this.type = type;
this.name = name;
this.price = price;
this.mealTime = mealTime;
}
// Getters and setters for private fields
public Type getType() {
return type;
}
public String getName() {
return name;
}
public double getPrice() {
return price;
}
public MealTime getMealTime() {
return mealTime;
}
public static int getTotalSales() {
return totalSales;
}
public static void incrementTotalSales() {
totalSales++;
}
}