Ejemplo n.º 1
0
        protected override Pizza CreatePizza(string type)
        {
            Pizza pizza = null;
            IPizzaIngredientFactory ingredientFactory = new NewYorkIngredientFactory();

            if (type.Equals("Cheese"))
            {
                pizza = new CheesePizza(ingredientFactory);
                pizza.SetName("New York Style Cheese");
            }
            else if (type.Equals("Greek"))
            {
                pizza = new GreekPizza(ingredientFactory);
                pizza.SetName("New York Style Greek");
            }
            else if (type.Equals("Pepperoni"))
            {
                pizza = new PepperoniPizza(ingredientFactory);
                pizza.SetName("New York Style Cheese Pepperoni");
            }
            else if (type.Equals("Veggie"))
            {
                pizza = new VeggiePizza(ingredientFactory);
                pizza.SetName("New York Style Veggie");
            }
            else if (type.Equals("Clam"))
            {
                pizza = new ClamPizza(ingredientFactory);
                pizza.SetName("New York Style Clam");
            }

            return(pizza);
        }
Ejemplo n.º 2
0
        public override Pizza CreatePizza(PizzaTypes pizzaType)
        {
            Pizza             pizza             = null;
            IngridientFactory ingridientFactory = new NYIngridientFactory();

            switch (pizzaType)
            {
            case PizzaTypes.Cheese:
                pizza = new CheesePizza(ingridientFactory);
                break;

            case PizzaTypes.Greek:
                pizza = new GreekPizza(ingridientFactory);
                break;

            case PizzaTypes.Papperoni:
                pizza = new PepperoniPizza(ingridientFactory);
                break;

            default:
                throw new ArgumentException("Wrong PizzaTypes");
            }
            if (pizza != null)
            {
                return(pizza);
            }
            else
            {
                throw new NullReferenceException("Pizza is null");
            }
        }
 public override Pizza CreatePizza(string type)
 {
     Pizza pizza = null;
     if (type.Equals("cheese"))
         pizza = new ChicagoCheesePizza();
     else if (type.Equals("greek"))
         pizza = new GreekPizza();
     else if (type.Equals("pepperoni"))
         pizza = new PepperoniPizza();
     return pizza;
 }
        public Pizza OrderPizza(string type)
        {
            Pizza pizza = null;
            if (type.Equals("cheese"))
                pizza = new CheesePizza();
            else if (type.Equals("greek"))
                pizza = new GreekPizza();
             else if (type.Equals("pepperoni"))
                 pizza = new PepperoniPizza();

            pizza.Prepare();
            pizza.Bake();
            pizza.Cut();
            pizza.Box();
            return pizza;
        }
Ejemplo n.º 5
0
        public Pizza createPizza(string type)
        {
            Pizza pizza;

            if (type.Equals("cheese"))
                pizza = new CheesePizza();
            else if (type.Equals("greek"))
                pizza = new GreekPizza();
            else if (type.Equals("peperoni"))
                pizza = new PeperoniPizza();
            else if (type.Equals("clam"))
                pizza = new ClamPizza();
            else if (type.Equals("veggie"))
                pizza = new VeggiePizza();
            else
                pizza = new PeperoniPizza();

            return pizza;
        }
Ejemplo n.º 6
0
        public override Pizza CreatePizza(EnumTypePizza type)
        {
            Pizza pizza = null;
            IPizzaIngredientFactory ingredientFactory = new CaliforniaPizzaIngredientFactory();

            switch (type)
            {
            case EnumTypePizza.Cheese:
                pizza      = new CheesePizza(ingredientFactory);
                pizza.Name = nameof(CheesePizza);
                break;

            case EnumTypePizza.Greek:
                pizza      = new GreekPizza(ingredientFactory);
                pizza.Name = nameof(GreekPizza);
                break;

            case EnumTypePizza.Pepperoni:
                pizza      = new PepperoniPizza(ingredientFactory);
                pizza.Name = nameof(PepperoniPizza);
                break;

            case EnumTypePizza.Clam:
                pizza      = new ClamPizza(ingredientFactory);
                pizza.Name = nameof(ClamPizza);
                break;

            case EnumTypePizza.Veggies:
                pizza      = new VeggiesPizza(ingredientFactory);
                pizza.Name = nameof(VeggiesPizza);
                break;

            default:
                throw new ApplicationException($"Type {type} not implemented.");
            }
            return(pizza);
        }
Ejemplo n.º 7
0
        public Pizza OrderPizza(string type)
        {
            Pizza pizza = new Pizza(console);

            if (type.Equals("cheese"))
            {
                pizza = new CheesePizza(console);
            }
            else if (type.Equals("greek"))
            {
                pizza = new GreekPizza(console);
            }
            else if (type.Equals("pepperoni"))
            {
                pizza = new PepperoniPizza(console);
            }

            pizza.Prepare();
            pizza.Bake();
            pizza.Cut();
            pizza.Box();

            return(pizza);
        }