Пример #1
0
        public void OderPizza(string type)
        {
            Pizza pizza;

            switch (type)
            {
            case "cheese":
                pizza = new CheesePizza();
                break;

            case "greek":
                pizza = new GreakPizza();
                break;

            case "pepperoni":
                pizza = new PepperoniPizza();
                break;

            default:
                Console.WriteLine("we do not have " + type);
                return;
            }

            pizza.Prepare();
            pizza.Bake();
            pizza.Cut();
            pizza.Box();
        }
Пример #2
0
        // look at the two pizza classes and spot the similarities. Try to encapsulate them
        // in a way that preserves the steps of the pizza making algorithm
        public static void Main()
        {
            Console.WriteLine("Making pepperoni pizza\n");

            PepperoniPizza pepperoniPizza = new PepperoniPizza();
            pepperoniPizza.Prepare();

            Console.WriteLine("\nMaking vegetarian pizza\n");

            VegetarianPizza vegetarianPizza = new VegetarianPizza();
            vegetarianPizza.Prepare();

            Console.WriteLine("\nPress any key to end...");
            Console.ReadKey();
        }
Пример #3
0
        // look at the two pizza classes and spot the similarities. Try to encapsulate them
        // in a way that preserves the steps of the pizza making algorithm

        public static void Main()
        {
            Console.WriteLine("Making pepperoni pizza\n");

            PepperoniPizza pepperoniPizza = new PepperoniPizza();

            pepperoniPizza.Prepare();

            Console.WriteLine("\nMaking vegetarian pizza\n");

            VegetarianPizza vegetarianPizza = new VegetarianPizza();

            vegetarianPizza.Prepare();

            Console.WriteLine("\nPress any key to end...");
            Console.ReadKey();
        }