示例#1
0
 public void ChickenSoup(ref Chicken chicken, ref Egg egg, ref Potato potato)
 {
     if (chicken.Weight >= 250 && egg.Count >= 1 && potato.Weight >= 150)
     {
         chicken.Weight -= 250;
         egg.Count      -= 1;
         potato.Weight  -= 150;
         Info?.Invoke(" Суп Готов! ");
     }
     else
     {
         if (chicken.Weight < 250)
         {
             Info?.Invoke("Не хватает курицы!");
         }
         if (egg.Count < 1)
         {
             Info?.Invoke(" Не хватает яйца! ");
         }
         if (potato.Weight < 150)
         {
             Info?.Invoke("Не хватает картофеля!");
         }
     }
 }
示例#2
0
 public static void OutputFood(Chicken chicken, Egg egg, Potato potato)
 {
     WriteLine("У вас осталось:");
     WriteLine($"{chicken.Weight} грамм курицы.");
     WriteLine($"{egg.Count} ед. яиц.");
     WriteLine($"{potato.Weight} грамм картофеля.");
 }
示例#3
0
        public static void InputFood(out Chicken chicken, out Egg egg, out Potato potato)
        {
            Write("Введите вес ципленка -");
            int weightChicken = Convert.ToInt32(ReadLine());

            Write("Введите количество яиц -");
            int countEgg = Convert.ToInt32(ReadLine());

            Write("Введите вес картофеля -");
            int weightPotato = Convert.ToInt32(ReadLine());

            chicken = new Chicken(weightChicken);
            egg     = new Egg(countEgg);
            potato  = new Potato(weightPotato);
        }