Exemplo n.º 1
0
        static void Main(string[] args)
        {
            Console.WriteLine("Bonjour, qu'est-ce que je vous sert ?");

            Kebab kebab = new Kebab();

            do
            {
                Console.WriteLine("Choisissez un ingrédient.");
                Ingredient.Display();

                int ing = -1;
                do
                {
                    string read = Console.ReadLine();
                    if (!Int32.TryParse(read, out ing))
                    {
                        ing = -1;
                        Console.WriteLine("Oups j'ai pas compris ce que vous avez dit...");
                    }

                    if (ing > Ingredient.ingredients.Count - 1)
                    {
                        ing = -1;
                        Console.WriteLine("Oups j'ai pas compris ce que vous avez dit...");
                    }
                } while (ing < 0);

                Console.WriteLine("Eh, dis donc j'en mets combien ?");
                int quantity = -1;
                do
                {
                    string read = Console.ReadLine();
                    if (!Int32.TryParse(read, out quantity))
                    {
                        quantity = -1;
                        Console.WriteLine("Oups j\'ai pas compris ce que vous avez dit...");
                    }
                } while (quantity < 0);

                if (!kebab.ingredients.ContainsKey(Ingredient.ingredients[ing]))
                {
                    kebab.ingredients.Add(Ingredient.ingredients[ing], quantity);
                }
                else
                {
                    kebab.ingredients[Ingredient.ingredients[ing]] = quantity;
                }


                Console.WriteLine();
                kebab.Display();
                Console.WriteLine("Je vous rajoute autre chose ? ENTER");
            } while (Console.ReadKey().Key == ConsoleKey.Enter);

            Console.WriteLine();
            Console.WriteLine("Ce kébab est " + kebab.IsVegetable());

            Console.ReadLine();
        }
Exemplo n.º 2
0
        protected override Kebab CreateKebab(string type)
        {
            Kebab kebab = null;
            IComponentsFactory componentsFactory = new FastKebabComponentsFactory();

            if (type == "Garlic")
            {
                kebab = new FastKebabSmall(componentsFactory);
            }

            return(kebab);
        }
Exemplo n.º 3
0
        protected override Kebab CreateKebab(string type)
        {
            Kebab kebab = null;
            IComponentsFactory componentsFactory = new StarKebabComponentsFactory();

            if (type == "Garlic")
            {
                kebab = new StarKebabKing(componentsFactory);
            }
            else if (type == "Ketchup")
            {
                kebab = new StarKebabHot(componentsFactory);
            }

            return(kebab);
        }
Exemplo n.º 4
0
        static void Main(string[] args)
        {
            Console.WriteLine("Hello World!");

            Kebab test = new Kebab(
                true,
                true,
                true,
                new List <Meat>()
            {
                Meat.Kebab
            },
                new List <Sauce>()
            {
                Sauce.Samourai
            },
                0
                );

            Console.WriteLine($"Kebab = {test}");

            bool isVegetarian = test.isVegetarian();

            Console.WriteLine($"Is Vegetarian = {isVegetarian.ToString()}");

            bool isPescetarian = test.isPescetarian();

            Console.WriteLine($"Is Pescetarian = {isPescetarian.ToString()}");

            Kebab cheese = test.addCheese();

            Console.WriteLine($"Kebab Cheese = ${cheese}");
            Kebab noOnion = test.withOutOnion();

            Console.WriteLine($"No Onion = {noOnion}");
        }