-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBuilderPatternDemo.java
More file actions
26 lines (21 loc) · 683 Bytes
/
BuilderPatternDemo.java
File metadata and controls
26 lines (21 loc) · 683 Bytes
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
package builder_pattern;
/**
* @ClassName BuilderPatternDemo
* @Description TODO
* @Author qulingxiao
* @Date 2020/7/18 10:55
* @Version 1.0
*/
public class BuilderPatternDemo {
public static void main(String[] args) {
MealBuilder mealBuilder = new MealBuilder();
Meal vegMeal = mealBuilder.prepareVegMeal();
System.out.println("Veg Meal");
vegMeal.showItems();
System.out.println("Total Cost: " +vegMeal.getPrice());
Meal nonVegMeal = mealBuilder.prepareNonVegMeal();
System.out.println("Non Veg Meal");
nonVegMeal.showItems();
System.out.println("Total Cost: " +nonVegMeal.getPrice());
}
}