Ejemplo n.º 1
0
        public static void MakeSomePizza(IPizzaBuilder builder)
        {
            bool   loopBreak = true;
            string str       = null;

            while (str != "0")
            {
                Console.WriteLine("\nChoose your option:\n");
                Console.WriteLine("" +
                                  "1 - Add Cheese\n" +
                                  "2 - Add Tomatoes\n" +
                                  "3 - Add Olives\n" +
                                  "4 - Add Meat\n" +
                                  "5 - Make Pizza\n" +
                                  "\n0 - exit\n");
                str = Console.ReadLine();
                switch (str)
                {
                case "1": builder.AddCheese(); loopBreak = false; break;

                case "2": builder.AddTomatoes(); loopBreak = false; break;

                case "3": builder.AddOlives(); loopBreak = false; break;

                case "4": builder.AddMeat(); loopBreak = false; break;

                case "5": Console.Write(builder.GetPizza()
                                        .ListIngredients()); loopBreak = true; break;

                case "0": loopBreak = true; break;

                default: Console.WriteLine("Enter the required number\n"); break;
                }
                if (loopBreak != false)
                {
                    builder.Reset();
                    break;
                }
            }
        }