Esempio n. 1
0
            public static void Main(String[] args)
            {
                Waiter       waiter = new Waiter();
                PizzaBuilder hawaiianPizzaBuilder = new HawaiianPizzaBuilder();

                waiter.SetPizzaBuilder(hawaiianPizzaBuilder);
                waiter.ConstructPizza();
                Pizza pizza1 = waiter.GetPizza();

                pizza1.Info();

                PizzaBuilder spicyPizzaBuilder = new SpicyPizzaBuilder();

                waiter.SetPizzaBuilder(spicyPizzaBuilder);
                waiter.ConstructPizza();
                Pizza pizza2 = waiter.GetPizza();

                pizza2.Info();

                PizzaBuilder margaritaPizzaBuilder = new MargaritaPizzaBuilder();

                waiter.SetPizzaBuilder(margaritaPizzaBuilder);
                waiter.ConstructPizza();
                Pizza pizza3 = waiter.GetPizza();

                pizza3.Info();
                Console.ReadKey();
            }
Esempio n. 2
0
        private static void RunPizzaExample()
        {
            IPizzaBuilder spicyPizzabuilder;
            IPizzaBuilder hawaiianPizzabuilder;
            Waiter        waiter;

            spicyPizzabuilder = new SpicyPizzaBuilder();
            waiter            = new Waiter(spicyPizzabuilder);
            waiter.Construct();
            waiter.GetPizza();

            Thread.Sleep(2000);

            hawaiianPizzabuilder = new HawaiianPizzaBuilder();
            waiter = new Waiter(hawaiianPizzabuilder);
            waiter.Construct();
            waiter.GetPizza();

            Thread.Sleep(2000);

            spicyPizzabuilder = new SpicyPizzaBuilder();
            waiter            = new Waiter(spicyPizzabuilder);
            waiter.Construct();
            waiter.GetPizza();
        }
Esempio n. 3
0
            // source код брав з гугл диску
            static void Main(string[] args)
            {
                Waiter       waiter = new Waiter();
                PizzaBuilder hawaiianPizzaBuilder = new HawaiianPizzaBuilder();
                PizzaBuilder spicyPizzaBuilder    = new SpicyPizzaBuilder();
                PizzaBuilder margaritaBuilder     = new MargaritaPizzaBuilder();

                Console.WriteLine("\ncustomer orders hawaiian\n");

                waiter.SetPizzaBuilder(hawaiianPizzaBuilder);
                waiter.ConstructPizza();

                Pizza pizza = waiter.GetPizza();

                pizza.Info();

                Console.WriteLine("\ncustomer orders spicy\n");

                waiter.SetPizzaBuilder(spicyPizzaBuilder);
                waiter.ConstructPizza();

                pizza = waiter.GetPizza();
                pizza.Info();

                Console.WriteLine("\ncustomer orders margarita\n");

                waiter.SetPizzaBuilder(margaritaBuilder);
                waiter.ConstructPizza();

                pizza = waiter.GetPizza();
                pizza.Info();

                Console.ReadKey();
            }
Esempio n. 4
0
        static void Main(string[] args)
        {
            Waiter       waiter = new Waiter();
            PizzaBuilder hawaiianPizzaBuilder = new HawaiianPizzaBuilder();
            PizzaBuilder spicyPizzaBuilder    = new SpicyPizzaBuilder();

            waiter.SetPizzaBuilder(hawaiianPizzaBuilder);
            waiter.ConstructPizza();

            Pizza pizza = waiter.GetPizza();
        }
Esempio n. 5
0
            public static void Main(String[] args)
            {
                Waiter       waiter = new Waiter();
                PizzaBuilder hawaiianPizzaBuilder = new
                                                    HawaiianPizzaBuilder();
                PizzaBuilder spicyPizzaBuilder = new SpicyPizzaBuilder();

                waiter.SetPizzaBuilder(hawaiianPizzaBuilder);
                waiter.ConstructPizza();
                Pizza pizza = waiter.GetPizza();

                pizza.Info();
                Console.ReadKey();
            }
        static void Main(string[] args)
        {
            PizzaBuilder hawaiianPizzaBuilder = new HawaiianPizzaBuilder();
            Cook cook = new Cook();
            cook.SetPizzaBuilder(hawaiianPizzaBuilder);
            cook.ConstructPizza();
            // create the product
            Pizza hawaiian = cook.GetPizza();

            PizzaBuilder spicyPizzaBuilder = new SpicyPizzaBuilder();
            cook.SetPizzaBuilder(spicyPizzaBuilder);
            cook.ConstructPizza();
            // create another product
            Pizza spicy = cook.GetPizza();
        }
Esempio n. 7
0
        static void Main(string[] args)
        {
            PizzaBuilder hawaiianPizzaBuilder = new HawaiianPizzaBuilder();
            Cook         cook = new Cook();

            cook.SetPizzaBuilder(hawaiianPizzaBuilder);
            cook.ConstructPizza();
            // create the product
            Pizza hawaiian = cook.GetPizza();

            PizzaBuilder spicyPizzaBuilder = new SpicyPizzaBuilder();

            cook.SetPizzaBuilder(spicyPizzaBuilder);
            cook.ConstructPizza();
            // create another product
            Pizza spicy = cook.GetPizza();
        }
Esempio n. 8
0
        static void Main(string[] args)
        {
            PizzaOrdering pizzaOrdering = new PizzaOrdering();

            SpicyPizzaBuilder spicyPizzaBuilder = new SpicyPizzaBuilder();

            pizzaOrdering.SetPizzaBuilder(spicyPizzaBuilder);
            pizzaOrdering.ConstructPizza();
            Pizza spicyPizza = pizzaOrdering.GetPizza();

            PrintPizzaIngredients("spicy pizza", spicyPizza);

            HawaiianPizzaBuilder hawaiianPizzaBuilder = new HawaiianPizzaBuilder();

            pizzaOrdering.SetPizzaBuilder(hawaiianPizzaBuilder);
            pizzaOrdering.ConstructPizza();
            Pizza hawaiianPizza = pizzaOrdering.GetPizza();

            PrintPizzaIngredients("hawaiian pizza", hawaiianPizza);

            Console.ReadKey();
        }