예제 #1
0
        public 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);
        }
예제 #2
0
        public Pizza CreatePizza(string style, string type)
        {
            Pizza pizza = null;

            if (style == "NY")
            {
                switch (type)
                {
                case "cheese":
                    pizza = new NYStyleCheesePizza();
                    break;

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

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

                case "pepperoni":
                    pizza = new NYStylePepperoniPizza();
                    break;
                }
            }
            else if (style == "Chicago")
            {
                switch (type)
                {
                case "cheese":
                    pizza = new ChicagoStyleCheesePizza();
                    break;

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

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

                case "pepperoni":
                    pizza = new ChicagoStylePepperoniPizza();
                    break;
                }
            }
            else
            {
                Console.WriteLine("Error: invalid store");
                return(null);
            }
            pizza.Prepare();
            pizza.Bake();
            pizza.Cut();
            pizza.Box();

            return(pizza);
        }
예제 #3
0
        public 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;
        }
예제 #4
0
        public Pizza CreatePizza(string style, string type)
        {
            Pizza pizza = null;

            if (style == "NY")
            {
                switch (type)
                {
                    case "cheese":
                        pizza = new NYStyleCheesePizza();
                        break;
                    case "veggie":
                        pizza = new NYStyleVeggiePizza();
                        break;
                    case "clam":
                        pizza = new NYStyleClamPizza();
                        break;
                    case "pepperoni":
                        pizza = new NYStylePepperoniPizza();
                        break;
                }
            }
            else if (style == "Chicago")
            {
                switch (type)
                {
                    case "cheese":
                        pizza = new ChicagoStyleCheesePizza();
                        break;
                    case "veggie":
                        pizza = new ChicagoStyleVeggiePizza();
                        break;
                    case "clam":
                        pizza = new ChicagoStyleClamPizza();
                        break;
                    case "pepperoni":
                        pizza = new ChicagoStylePepperoniPizza();
                        break;
                }
            }
            else
            {
                Console.WriteLine("Error: invalid store");
                return null;
            }
            pizza.Prepare();
            pizza.Bake();
            pizza.Cut();
            pizza.Box();

            return pizza;
        }