thespeedracer38

PizzaStore

Apr 10th, 2019
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.78 KB | None | 0 0
  1. public class PizzaStore {
  2.     static Pizza orderPizza(String type){
  3.         // Assuming, user has not ordered a Pizza
  4.         Pizza myPizza = null;
  5.         //Pizza *myPizza = null;
  6.         if("Chicken Pizza".equalsIgnoreCase(type)){
  7.             myPizza = new ChickenPizza();
  8.         }
  9.         else if("Corn Pizza".equalsIgnoreCase(type)){
  10.             myPizza = new CornPizza();
  11.         }
  12.         else if("Paneer Pizza".equalsIgnoreCase(type)){
  13.             myPizza = new PaneerPizza();
  14.         }
  15.         else{
  16.             System.out.println("Pizza type not available");
  17.         }
  18.         if(myPizza != null){
  19.             myPizza.prepare();
  20.             myPizza.bake();
  21.             myPizza.cut();
  22.             myPizza.box();
  23.         }
  24.        
  25.         return myPizza;
  26.     }
  27. }
Add Comment
Please, Sign In to add comment