Пример #1
0
 public void GetWinner(Footballer fk1, Footballer fk2, PlaygroundFootballHandler del)
 {
     _del = del;
     if (fk1.GetIntGoals() > fk2.GetIntGoals())
     {
         if (_del != null)
         {
             _del($"\n\n{fk1.Name} is winner \n\n\n");
         }
     }
     else
     {
         if (fk2.GetIntGoals() > fk1.GetIntGoals())
         {
             if (_del != null)
             {
                 _del($"\n\n{fk2.Name} is winner \n\n\n");
             }
         }
         else
         {
             if (fk1.GetIntGoals() == fk2.GetIntGoals())
             {
                 if (_del != null)
                 {
                     _del("\n\nDraw game!\n\n\n");
                 }
             }
         }
     }
 }
Пример #2
0
 public void FinalScore(Footballer fk1, Footballer fk2, PlaygroundFootballHandler del)
 {
     _del = del;
     if (_del != null)
     {
         _del($"\n\n{fk1.Name} scored {fk1.GetIntGoals()} goals");
         _del($"{fk2.Name} scored {fk2.GetIntGoals()} goals\n\n\n");
     }
 }
Пример #3
0
        static void Main(string[] args)
        {
            int  meatCalorie       = 445;
            int  vegetablesCalorie = 123;
            int  fruitsCalorie     = 167;
            int  porridgeCalorie   = 234;
            bool isCorrect         = true;

            Console.Write($"\nStart\n");
            while (isCorrect)
            {
                Console.Write($"\n1:Footballers\n");
                Console.Write($"2:Basketball players\n");
                Console.Write($"3:Create List\n");
                Console.Write($"4:Using a comparator\n");
                Console.Write($"5:Create clone\n");
                Console.Write($"6:Exit\n");
                Console.Write("Make a choice:\n");
                string choiseSportsman = Console.ReadLine();
                switch (choiseSportsman)
                {
                case "1":
                    Footballers fk = new Footballers();
                    fk[0] = new Footballer(17, 170, 60)
                    {
                        Name = "Tom"
                    };
                    Footballer Tom = fk[0];
                    Footballer.GetNationality();
                    Tom.GetInfo();
                    Tom.GetInfoDailyIntake();

                    int    calorieNowTom = 0;
                    double drunkWaterTom = 0;

                    Console.Write("\n\n");

                    drunkWaterTom = ((IDrink <double>)Tom).DrunkingWater(drunkWaterTom);
                    calorieNowTom = ((INutrition <int>)Tom).Nutrition(calorieNowTom, meatCalorie, vegetablesCalorie, fruitsCalorie, porridgeCalorie);

                    Console.Write("\n\n");

                    Tom.GetInfo(calorieNowTom, drunkWaterTom);

                    Tom.GetEnergy(calorieNowTom, drunkWaterTom);
                    Tom.GetInfoEnergy();


                    Console.ReadKey();


                    Console.Write("\n\n///////////////\nNew personage:\n///////////////\n\n");

                    fk[1] = new Footballer(17, 190, 100)
                    {
                        Name = "Oleg"
                    };
                    Footballer Oleg = fk[1];
                    Footballer.GetNationality();
                    Oleg.GetInfo();
                    Oleg.GetInfoDailyIntake();

                    int    calorieNowOleg = 0;
                    double drunkWaterOleg = 0;

                    Console.Write("\n\n");

                    drunkWaterOleg = ((IDrink <double>)Oleg).DrunkingWater(drunkWaterOleg);
                    calorieNowOleg = ((INutrition <int>)Oleg).Nutrition(calorieNowOleg, meatCalorie, vegetablesCalorie, fruitsCalorie, porridgeCalorie);

                    Console.Write("\n\n");

                    Oleg.GetInfo(calorieNowOleg, drunkWaterOleg);

                    Oleg.GetEnergy(calorieNowOleg, drunkWaterOleg);
                    Oleg.GetInfoEnergy();

                    PlayGround firstPlayGround = new PlayGround();

                    firstPlayGround.StartGame();

                    Tom.GetInfo();
                    Tom.GetInfoEnergy();