Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class PizzaStore {
- static Pizza orderPizza(String type){
- // Assuming, user has not ordered a Pizza
- Pizza myPizza = null;
- //Pizza *myPizza = null;
- if("Chicken Pizza".equalsIgnoreCase(type)){
- myPizza = new ChickenPizza();
- }
- else if("Corn Pizza".equalsIgnoreCase(type)){
- myPizza = new CornPizza();
- }
- else if("Paneer Pizza".equalsIgnoreCase(type)){
- myPizza = new PaneerPizza();
- }
- else{
- System.out.println("Pizza type not available");
- }
- if(myPizza != null){
- myPizza.prepare();
- myPizza.bake();
- myPizza.cut();
- myPizza.box();
- }
- return myPizza;
- }
- }
Add Comment
Please, Sign In to add comment