forked from premaseem/DesignPatternsJava9
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathClient.java
More file actions
42 lines (35 loc) · 1.5 KB
/
Copy pathClient.java
File metadata and controls
42 lines (35 loc) · 1.5 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
package com.premaseem;
import com.premaseem.factory.PizzaBase;
import com.premaseem.factory.PizzaFactory;
import java.util.Scanner;
/*
@author: Aseem Jain
@title: Design Patterns with Java 9
@link: https://premaseem.wordpress.com/category/computers/design-patterns/
@copyright: 2018 Packt Publication
*/
public class Client {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int repeatRunFlag = 1;
while (repeatRunFlag == 1) {
System.out.println("This is the Client Main Factory Pattern ");
System.out.println("What kind of Pizza would you like to have ? ");
System.out.println("Enter veg for veg pizza ");
System.out.println("Enter non-veg for Non veg pizza ");
System.out.println("Enter max for Non Mexican pizza ");
String pizzaType = scan.next();
PizzaBase pizza = PizzaFactory.getPizza(pizzaType);
System.out.println("Your final order is");
System.out.println(pizza.getDescription());
System.out.println("Toal cost of order is " + pizza.getCost());
System.out.println("\n $$$$$$$$$$$$$$$$$$$$ Thanks by Prem Aseem $$$$$$$$$$$$$$$$$$$$$$ \n ");
System.out.println("Do you want to Re-run this program - Press 1 for yes and 0 or other digits to EXIT ");
try{
repeatRunFlag = scan.nextInt();
}catch(Exception e){
repeatRunFlag = 0;
}
}
}
}