예제 #1
0
        public List <object> Products()
        {
            List <object> products = new List <object>();
            Beet          Beet     = new Beet();
            Carrot        Carrot   = new Carrot();
            Meat          Meat     = new Meat();
            Onion         Onion    = new Onion();
            Potato        Potato   = new Potato();
            Rise          Rise     = new Rise();

            Beet.Name   = "Свёкла";
            Carrot.Name = "Морковь";
            Meat.Name   = "Мясо";
            Onion.Name  = "Лук";
            Potato.Name = "Картошка";
            Rise.Name   = "Рис";

            products.AddRange(new object[] { Beet, Carrot, Meat, Onion, Potato, Rise });

            return(products);
        }
예제 #2
0
        static void Main()
        {
            ICookBorshch  cookBorshch  = new Borshch();
            ICookPilaf    cookPilaf    = new Pilaf();
            ICookRagout   cookRagout   = new Ragout();
            IReadyBorshch readyBorshch = new Chef();
            IReadyPilaf   readyPilaf   = new Chef();
            IReadyRagout  readyRagout  = new Chef();

            Chef Kolya = new Chef
            {
                Age  = 40,
                Name = "Колян"
            };

            Chef Vitya = new Chef
            {
                Age  = 35,
                Name = "Витёк"
            };

            Chef Vasya = new Chef
            {
                Age  = 25,
                Name = "Васька"
            };

            Borshch borshch = new Borshch();
            Pilaf   pilaf   = new Pilaf();
            Ragout  ragout  = new Ragout();
            Cutting cut     = new Cutting();

            Beet   beet   = new Beet();
            Carrot carrot = new Carrot();
            Meat   meat   = new Meat();
            Onion  onion  = new Onion();
            Potato potato = new Potato();
            Rise   rise   = new Rise();

            List <object> friedBorshch  = cookBorshch.FryBorshch();
            List <object> boiledBorshch = cookBorshch.BoilBorshch();
            List <object> friedPilaf    = cookPilaf.FryPilaf();
            List <object> boiledPilaf   = cookPilaf.BoilPilaf();
            List <object> friedRagout   = cookRagout.FryRagout();
            List <object> boiledRagout  = cookRagout.BoilRagout();

            List <List <object> > readyBorshchDish = readyBorshch.FinishedDishBorshch(friedBorshch, boiledBorshch);
            List <List <object> > readyPilafDish   = readyPilaf.FinishedDishPilaf(friedPilaf, boiledPilaf);
            List <List <object> > readyRagoutDish  = readyRagout.FinishedDishRagout(friedRagout, boiledRagout);

            cut.Products();

            Console.WriteLine($"Сегодняшние повара:" +
                              $"\n\n{Kolya.Name} ({Kolya.Age} лет), {Vasya.Name} ({Vasya.Age} лет) и {Vitya.Name} ({Vitya.Age} лет)" +
                              $"\n\nОни приготовили сегодня:" +
                              $"\n{borshch.Dish}, {pilaf.Dish}, {ragout.Dish}" +
                              $"\n\nРецепт такой:" +
                              $"\n\n{beet.Name} - {beet.Weight} кг" +
                              $"\n{carrot.Name} - {carrot.Weight} кг" +
                              $"\n{meat.Name} - {meat.Weight} (тип {meat.Type}) кг" +
                              $"\n{onion.Name} - {onion.Weight}" +
                              $"\n{potato.Name} - {potato.Weight}" +
                              $"\n{rise.Name} - {rise.Weight} (тип {rise.Type}) кг" +
                              $"\n{cut.Pepper}" +
                              $"\n{cut.Salt}" +
                              $"\n{cut.Spices}");
            Console.WriteLine("\n\nГотовили блюда следующим образом:");

            foreach (var mainList in readyBorshchDish)
            {
                foreach (var item in mainList)
                {
                    Console.WriteLine("");
                    Console.WriteLine($"{item}");
                }
            }
        }
        static void Main(string[] args)
        {
            string        input = Console.ReadLine();
            int           numberOfInputLines = 1;
            Mammal        animall            = null;
            Food          foodd   = null;
            List <Animal> animals = new List <Animal>();

            while (input != "End")
            {
                numberOfInputLines++;
                if (numberOfInputLines % 2 == 0)
                {
                    string[] animal     = input.Split().ToArray();
                    string   animalType = animal[0];
                    if (animal.Length == 4)
                    {
                        if (animalType == "Tiger")
                        {
                            animall = new Tiger(animalType, animal[1], double.Parse(animal[2]),
                                                (animal[3]));
                            animals.Add(animall);
                        }
                        else if (animalType == "Zebra")
                        {
                            animall = new Zebra(animalType, animal[1], double.Parse(animal[2]),
                                                (animal[3]));
                            animals.Add(animall);
                        }
                        else if (animalType == "Mouse")
                        {
                            animall = new Mouse(animalType, animal[1], double.Parse(animal[2]),
                                                (animal[3]));
                            animals.Add(animall);
                        }
                    }
                    else
                    {
                        animall = new Cat(animalType, animal[1], double.Parse(animal[2]),
                                          (animal[3]), animal[4]);
                        animals.Add(animall);
                    }
                }
                else
                {
                    string[] food     = input.Split().ToArray();
                    string   foodType = food[0];
                    if (foodType == "Meat")
                    {
                        foodd = new Meat(int.Parse(food[1]));
                    }
                    else
                    {
                        foodd = new Vegetable(int.Parse(food[1]));
                    }
                }

                Console.WriteLine();
                if (animall.Type != "Cat")
                {
                    Console.Write(animall.Type + "[" + animall.Name + "," + animall.Weight + ","
                                  + animall.LivingRegion + ",");
                }

                animall.Eat(foodd);
                Console.WriteLine("]");
                Console.WriteLine();
                input = Console.ReadLine();
            }
        }