-
Notifications
You must be signed in to change notification settings - Fork 166
Expand file tree
/
Copy pathAmulIceCreamFactory.java
More file actions
47 lines (37 loc) · 1.32 KB
/
AmulIceCreamFactory.java
File metadata and controls
47 lines (37 loc) · 1.32 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
package com.premaseem;
import com.premaseem.icecreams.ChocolateIceCream;
import com.premaseem.icecreams.IceCream;
import com.premaseem.icecreams.StrawberryIceCream;
import com.premaseem.milkshake.ChocolateMilkShake;
import com.premaseem.milkshake.MilkShake;
import com.premaseem.milkshake.StrawberryMilkShake;
/*
@author: Aseem Jain
@title: Design Patterns with Java 9
@link: https://premaseem.wordpress.com/category/computers/design-patterns/
*/
/**
* This factory creates all daily products of Amul Brand
*/
public class AmulIceCreamFactory extends AbstractIceCreamFactory{
@Override
public IceCream createIceCream(String iceCreamChoice){
IceCream iceCream = null;
if (iceCreamChoice.equalsIgnoreCase("Strawberry")){
iceCream = new StrawberryIceCream("Amul",2,120);
}else if (iceCreamChoice.equalsIgnoreCase("Chocolate")){
iceCream = new ChocolateIceCream("Amul",2,250);
}
return iceCream;
}
@Override
MilkShake createMilkShake (String choice) {
MilkShake milkShake = null;
if (choice.equalsIgnoreCase("Strawberry")){
milkShake = new StrawberryMilkShake("Amul",2);
}else if (choice.equalsIgnoreCase("Chocolate")){
milkShake = new ChocolateMilkShake("Amul",2);
}
return milkShake;
}
}