protected override Pizza CreatePizza(string item)
        {
            Pizza pizza = null;

            switch (item)
            {
            case "cheese":
                pizza = new NYStyleCheesePizza();
                break;

            case "veggie":
                pizza = new NYStyleVeggiePizza();
                break;

            case "clam":
                pizza = new NYStyleClamPizza();
                break;

            case "pepperoni":
                pizza = new NYStylePepperoniPizza();
                break;
            }

            return(pizza);
        }
        override protected Pizza createPizza(PizzaTypes type)
        {
            Pizza pizza = null;

            switch (type) // for type safety we can use enum and a switch rather than checking strings with conditional statements
            {
            case PizzaTypes.cheese:
                pizza = new NYStyleCheesePizza();
                break;

            case PizzaTypes.pepperoni:
                pizza = new NYStylePepperoniPizza();
                break;

            case PizzaTypes.clam:
                pizza = new NYStyleClamPizza();
                break;

            case PizzaTypes.veggie:
                pizza = new NYStyleVeggiePizza();
                break;

            default:
                break;
            }

            return(pizza);
        }
        protected override Pizza CreatePizza(string type)
        {
            Pizza pizza = null;

            switch (type)
            {
            case "Cheese":
                pizza = new NYStyleCheesePizza();
                break;

            case "Pepperoni":
                pizza = new NYStylePepperoniPizza();
                break;

            case "Clam":
                pizza = new NYStyleClamPizza();
                break;

            case "Veggie":
                pizza = new NYStyleVeggiePizza();
                break;
            }

            return(pizza);
        }
        public override APizza CreatePizza(PizzaType type)
        {
            APizza pizza = null;

            switch (type)
            {
            case PizzaType.Cheese:
                pizza = new NYStyleCheesePizza();
                break;

            case PizzaType.Pepperoni:
                pizza = new NYStylePepperoniPizza();
                break;

            case PizzaType.Clam:
                pizza = new NYStyleClamPizza();
                break;

            case PizzaType.Veggie:
                pizza = new NYStyleVeggiePizza();
                break;

            default:
                pizza = new NYStyleCheesePizza();
                break;
            }

            return(pizza);
        }
Exemple #5
0
        public override Pizza CreatePizza(string type)
        {
            Pizza pizza = null;

            switch (type)
            {
            case "Cheese":
                pizza = new NYStyleCheesePizza();
                break;

            case "Clam":
                pizza = new NYStyleClamPizza();
                break;

            default:
                Console.WriteLine("Please select valid pizza type.");
                break;
            }
            return(pizza);
        }
        protected override Pizza CreatePizza(string type)
        {
            Pizza pizza = null;

            switch (type)
            {
                case "Cheese":
                    pizza = new NYStyleCheesePizza();
                    break;
                case "Pepperoni":
                    pizza = new NYStylePepperoniPizza();
                    break;
                case "Clam":
                    pizza = new NYStyleClamPizza();
                    break;
                case "Veggie":
                    pizza = new NYStyleVeggiePizza();
                    break;
            }

            return pizza;
        }
Exemple #7
0
        public override Pizza CreatePizza(string type)
        {
            Pizza pizza = null;

            if (type.Equals("cheese"))
            {
                pizza = new NYStyleCheesePizza();
            }
            else if (type.Equals("pepperoni"))
            {
                pizza = new NYStylePepperoniPizza();
            }
            else if (type.Equals("clam"))
            {
                pizza = new NYStyleClamPizza();
            }
            else if (type.Equals("veggie"))
            {
                pizza = new NYStyleVeggiePizza();
            }

            return(pizza);
        }
Exemple #8
0
        public override Pizza CreatePizza(PizzaType pizzaType)
        {
            Pizza pizza = null;

            if (pizzaType == PizzaType.Cheese)
            {
                pizza = new NYStyleCheesePizza();
            }
            else if (pizzaType == PizzaType.Veggie)
            {
                pizza = new NYStyleVeggiePizza();
            }
            else if (pizzaType == PizzaType.Pepperoni)
            {
                pizza = new NYStylePepperoniPizza();
            }
            else if (pizzaType == PizzaType.Clam)
            {
                pizza = new NYStyleClamPizza();
            }

            return(pizza);
        }