Beispiel #1
0
 public void GetWinner(BasketballPlayer bk1, BasketballPlayer bk2)
 {
     if (bk1.GetIntPoints() > bk2.GetIntPoints())
     {
         Console.WriteLine($"\n\n{bk1.Name} is winner \n\n\n");
     }
     else
     {
         if (bk2.GetIntPoints() > bk1.GetIntPoints())
         {
             Console.WriteLine($"\n\n{bk2.Name} is winner \n\n\n");
         }
         else
         {
             if (bk1.GetIntPoints() == bk2.GetIntPoints())
             {
                 Console.WriteLine("\n\nDraw game!\n\n\n");
             }
         }
     }
 }
Beispiel #2
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: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 = Tom.DrunkingWater(drunkWaterTom);
                    calorieNowTom = 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 = Oleg.DrunkingWater(drunkWaterOleg);
                    calorieNowOleg = 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();
                    Tom.Game();

                    Oleg.GetInfo();
                    Oleg.GetInfoEnergy();
                    Oleg.Game();

                    firstPlayGround.FinalScore(Tom, Oleg);
                    firstPlayGround.GetWinner(Tom, Oleg);


                    Console.ReadKey();


                    break;

                case "2":
                    BasketballPlayers bk = new BasketballPlayers();
                    bk[0] = new BasketballPlayer(17, 170, 60)
                    {
                        Name = "Tom"
                    };
                    BasketballPlayer Vlad = bk[0];
                    BasketballPlayer.GetNationality();
                    Vlad.GetInfo();
                    Vlad.GetInfoDailyIntake();

                    int    calorieNowVlad = 0;
                    double drunkWaterVlad = 0;

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

                    drunkWaterVlad = Vlad.DrunkingWater(drunkWaterVlad);
                    calorieNowVlad = Vlad.Nutrition(calorieNowVlad, meatCalorie, vegetablesCalorie, fruitsCalorie, porridgeCalorie);

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

                    Vlad.GetInfo(calorieNowVlad, drunkWaterVlad);

                    Vlad.GetEnergy(calorieNowVlad, drunkWaterVlad);
                    Vlad.GetInfoEnergy();


                    Console.ReadKey();


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

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

                    int    calorieNowArtyom = 0;
                    double drunkWaterArtyom = 0;

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

                    drunkWaterArtyom = Artyom.DrunkingWater(drunkWaterArtyom);
                    calorieNowArtyom = Artyom.Nutrition(calorieNowArtyom, meatCalorie, vegetablesCalorie, fruitsCalorie, porridgeCalorie);

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

                    Artyom.GetInfo(calorieNowArtyom, drunkWaterArtyom);

                    Artyom.GetEnergy(calorieNowArtyom, drunkWaterArtyom);
                    Artyom.GetInfoEnergy();

                    PlayGround secondPlayGround = new PlayGround();

                    secondPlayGround.StartGame();

                    Vlad.GetInfo();
                    Vlad.GetInfoEnergy();
                    Vlad.Game();

                    Artyom.GetInfo();
                    Artyom.GetInfoEnergy();
                    Artyom.Game();

                    secondPlayGround.FinalScore(Vlad, Artyom);
                    secondPlayGround.GetWinner(Vlad, Artyom);


                    Console.ReadKey();


                    break;

                case "3":
                    List <Sportsman> sportsmen = new List <Sportsman>()
                    {
                        new BasketballPlayer(10, 140, 50)
                        {
                            Name = "Alex"
                        }, new Footballer(13, 163, 67)
                        {
                            Name = "Nikolai"
                        }
                    };
                    foreach (Sportsman p in sportsmen)
                    {
                        Console.WriteLine();
                        Console.Write(p.Name);
                        Console.WriteLine($" energy:{p.RecoveryEnergy()}");
                    }


                    Console.ReadKey();


                    break;

                case "4":
                    isCorrect = false;
                    break;
                }
            }
        }
Beispiel #3
0
 public void FinalScore(BasketballPlayer bk1, BasketballPlayer bk2)
 {
     Console.WriteLine($"\n\n{bk1.Name} scored {bk1.GetIntPoints()} points");
     Console.WriteLine($"{bk2.Name} scored {bk2.GetIntPoints()} points\n\n\n");
 }