-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathShop.java
More file actions
119 lines (98 loc) · 3.36 KB
/
Shop.java
File metadata and controls
119 lines (98 loc) · 3.36 KB
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
/*
Copyright (c) 2025 Ahmed R. Sadik, Honda Research Institute Europe GmbH
This source code is licensed under the MIT License found in the
LICENSE file in the root directory of this source tree. This dataset contains smelly code for research and refactoring purposes.
*/
public class Shop {
private Chef chef;
private Cashier cashier;
private Pizza pizza;
private boolean frequentCustomerDiscount;
private String firstName;
private String lastName;
private String address;
private String phoneNumber;
private String email;
private String tempDiscountCode;
private String tempOrderNote;
public Shop() {
this.chef = new Chef();
this.cashier = new Cashier(chef);
this.frequentCustomerDiscount = false;
}
public void receiveOrder(String pizzaType) {
System.out.println("Shop received order for " + pizzaType + " pizza.");
this.pizza = createPizza(pizzaType);
cashier.takeOrder(pizzaType);
}
public Pizza createPizza(String pizzaType) {
if (pizzaType.equals("Cheese")) {
return new CheesePizza();
} else if (pizzaType.equals("Veggie")) {
return new VeggiePizza();
} else if (pizzaType.equals("Tuna")) {
return new TunaPizza();
} else if (pizzaType.equals("Pepperoni")) {
return new PepperoniPizza();
} else {
throw new IllegalArgumentException("Unknown pizza type");
}
}
public Cashier getCashier() {
return this.cashier;
}
public Chef getChef() {
return this.chef;
}
public void updateContactInfo(String firstName, String lastName, String address, String phoneNumber, String email) {
this.firstName = firstName;
this.lastName = lastName;
this.address = address;
this.phoneNumber = phoneNumber;
this.email = email;
}
public void updateName(String firstName, String lastName) {
this.firstName = firstName;
this.lastName = lastName;
}
public void updateAddress(String address) {
this.address = address;
}
public void updatePhoneNumber(String phoneNumber) {
this.phoneNumber = phoneNumber;
}
public void updateEmail(String email) {
this.email = email;
}
public void notifyForPromotion() {
System.out.println("Notifying customer for promotion");
}
public void notifyForDiscount() {
System.out.println("Notifying customer for discount");
}
public void notifyForNewArrivals() {
System.out.println("Notifying customer for new arrivals");
}
public void applyDiscount() {
System.out.println("Applying discount for customer");
}
public void applyLoyaltyPoints() {
System.out.println("Applying loyalty points for customer");
}
public void handleComplaint(String complaint) {
if (complaint.equals("cold pizza")) {
cashier.calmCustomerDown();
} else if (complaint.equals("late delivery")) {
cashier.calmCustomerDown();
} else if (complaint.equals("wrong order")) {
cashier.calmCustomerDown();
} else {
cashier.calmCustomerDown();
}
}
public void askForReceipt() {
System.out.println("Customer is asking for a receipt.");
}
public void anotherUnusedMethod() {
}
}