Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            string          varietyInput = string.Empty;
            string          pizzeria     = string.Empty;
            string          variety      = string.Empty;
            PizzeriaFactory factory      = null;

            Console.WriteLine("Welcome to Pizzeria Factory App!\n\n");
            Console.WriteLine("List of pizza variety\n\n1. Cheese Pizza\n2. Clam Pizza\n3. Veggies Pizza\n");
            Console.Write("Choose your desired pizza: ");

            varietyInput = Console.ReadLine();

            if (varietyInput == "1")
            {
                variety = Variety.Cheese;
            }
            else if (varietyInput == "2")
            {
                variety = Variety.Clam;
            }
            else
            {
                variety = Variety.Veggies;
            }

            Console.WriteLine("\nList of Pizzerias\n\n1. Pizzeria A\n2. Pizzeria B\n");
            Console.Write("Choose your desired pizzeria: ");

            pizzeria = Console.ReadLine();

            if (pizzeria == "1")
            {
                factory = new PizzeriaAFactory();
            }
            else
            {
                factory = new PizzeriaBFactory();
            }

            factory.Order(variety);
            Thread.Sleep(1000);

            factory.Prepare();
            Thread.Sleep(1000);

            factory.Bake();
            Thread.Sleep(1000);

            factory.Cut();
            Thread.Sleep(1000);

            factory.Box();
            Thread.Sleep(1000);

            Console.WriteLine("\nThank you for using this Kettle App.\nPress any key to exit! ");
            Console.ReadLine();
        }
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            Console.WriteLine("PIZZERIA A");
            PizzeriaFactory pizzeriaA = new PizzeriaAFactory();

            Console.WriteLine($"ORDER: {OrderParamConst.Cheese}");
            pizzeriaA.Order(OrderParamConst.Cheese);
            Console.WriteLine(pizzeriaA.Prepare());
            Console.WriteLine(pizzeriaA.Bake());
            Console.WriteLine(pizzeriaA.Cut());
            Console.WriteLine(pizzeriaA.Box());

            Console.WriteLine(Environment.NewLine);

            Console.WriteLine($"ORDER: {OrderParamConst.Clam}");
            pizzeriaA.Order(OrderParamConst.Clam);
            Console.WriteLine(pizzeriaA.Prepare());
            Console.WriteLine(pizzeriaA.Bake());
            Console.WriteLine(pizzeriaA.Cut());
            Console.WriteLine(pizzeriaA.Box());

            Console.WriteLine(Environment.NewLine);

            Console.WriteLine($"ORDER: {OrderParamConst.Veggie}");
            pizzeriaA.Order(OrderParamConst.Veggie);
            Console.WriteLine(pizzeriaA.Prepare());
            Console.WriteLine(pizzeriaA.Bake());
            Console.WriteLine(pizzeriaA.Cut());
            Console.WriteLine(pizzeriaA.Box());


            Console.WriteLine("===========================================================================");


            Console.WriteLine("PIZZERIA B");
            PizzeriaFactory pizzeriaB = new PizzeriaBFactory();

            Console.WriteLine($"ORDER: {OrderParamConst.Cheese}");
            pizzeriaB.Order(OrderParamConst.Cheese);
            Console.WriteLine(pizzeriaB.Prepare());
            Console.WriteLine(pizzeriaB.Bake());
            Console.WriteLine(pizzeriaB.Cut());
            Console.WriteLine(pizzeriaB.Box());

            Console.WriteLine(Environment.NewLine);

            Console.WriteLine($"ORDER: {OrderParamConst.Clam}");
            pizzeriaB.Order(OrderParamConst.Clam);
            Console.WriteLine(pizzeriaB.Prepare());
            Console.WriteLine(pizzeriaB.Bake());
            Console.WriteLine(pizzeriaB.Cut());
            Console.WriteLine(pizzeriaB.Box());

            Console.WriteLine(Environment.NewLine);

            Console.WriteLine($"ORDER: {OrderParamConst.Veggie}");
            pizzeriaB.Order(OrderParamConst.Veggie);
            Console.WriteLine(pizzeriaB.Prepare());
            Console.WriteLine(pizzeriaB.Bake());
            Console.WriteLine(pizzeriaB.Cut());
            Console.WriteLine(pizzeriaB.Box());

            Console.ReadLine();
        }