internal override Pizza CreatePizza(string item) { Pizza pizza = null; IPizzaIngredientFactory ingredientFactory = new NYPizzaIngredientFactory(); if (item.Equals("cheese")) { pizza = new CheesePizza(ingredientFactory); pizza.Name = "California Style Cheese Pizza"; } else if (item.Equals("veggie")) { pizza = new VeggiePizza(ingredientFactory); pizza.Name = "California Style Veggie Pizza"; } else if (item.Equals("clam")) { pizza = new ClamPizza(ingredientFactory); pizza.Name = "California Style Clam Pizza"; } else if (item.Equals("pepperoni")) { pizza = new PepperoniPizza(ingredientFactory); pizza.Name = "California Style Pepperoni Pizza"; } return(pizza); }
public Pizza CreatePizza(string type) { Pizza pizza = null; switch (type) { case "cheese": pizza = new CheesePizza(); break; case "pepperoni": pizza = new PepperoniPizza(); break; case "clam": pizza = new ClamPizza(); break; case "veggie": pizza = new VeggiePizza(); break; default: pizza = new CrustPizza(); break; } return(pizza); }
public override Pizza createPizza(string type) { Pizza pizza = null; IPizzaIngredientFactory ingredientFactory = new NYPizzaIntergredientFactory(); if (type.Equals("cheese")) { pizza = new CheesePizza(ingredientFactory); pizza.setName("New York Style Cheese Pizza"); } if (type.Equals("clam")) { pizza = new ClamPizza(ingredientFactory); pizza.setName("New York Style Clam Pizza"); } return(pizza); }
public Pizza OrderPizza(string type) { Pizza pizza; // Problem is that this needs to be modified every time a new pizza class is created. // Modified here and anywhere else that instantiates a pizza class. switch (type) { case "cheese": pizza = new CheesePizza(); break; case "pepperoni": pizza = new PepperoniPizza(); break; case "clam": pizza = new ClamPizza(); break; case "veggie": pizza = new VeggiePizza(); break; default: pizza = new CrustPizza(); break; } pizza.Prepare(); pizza.Bake(); pizza.Cut(); pizza.Box(); return(pizza); }