Esempio n. 1
0
        static void Main(string[] args)
        {
            Person.GetPeopleNum();

            Person person1 = new Person();

            person1.Name        = "Tanusha";
            person1.Surname     = "Shurko";
            person1.Age         = 18;
            person1.Sex         = true;
            person1.HomeAddress = "st. Nemanskaya 9-78";
            person1.Marriage    = false;
            person1.Country     = "Belarus";
            person1.DateOfBirth = DateTime.Parse("28.07.2002");
            person1.ShowInfo();

            Console.WriteLine();

            Person[] people = new Person[10];
            for (int i = 0; i < people.Length; i++)
            {
                people[i] = new Person();
                people[i].GenFields();
                people[i].ShowInfo();
            }

            Person person2 = new Person(false, false, "st.Adremak 6 - 89", "Pavel", "Grentrey", "Greece", DateTime.Parse("19.03.2018"));

            Console.WriteLine(person2);

            Person person3 = new Person(20, true, false, "st.Kolj 13 - 87", "Ariana", "Themy", "France", DateTime.Parse("13.07.2000"));

            Console.WriteLine(person3);

            Person.GetPeopleNum();
            People obj = new People(13);

            Console.WriteLine(obj);

            Person someone = new Person();

            someone = obj.findYoungest();
            Console.WriteLine(someone);
            Console.WriteLine();

            Person iXPerson = obj[13];

            obj[-1] = someone;
            obj[0]  = someone;
            Console.WriteLine(obj);
        }
Esempio n. 2
0
        static void Main(string[] args)
        {
            Person.GetPeopleNum();

            Person person1 = new Person();

            person1.Name        = "Tanusha";
            person1.Surname     = "Shurko";
            person1.Age         = 18;
            person1.Sex         = true;
            person1.HomeAddress = "st. Nemanskaya 9-78";
            person1.Marriage    = false;
            person1.Country     = "Belarus";
            person1.DateOfBirth = DateTime.Parse("28.07.2002");
            person1.ShowInfo();

            Console.WriteLine();

            Person[] people = new Person[10];
            for (int i = 0; i < people.Length; i++)
            {
                people[i] = new Person();
                people[i].GenFields();
                people[i].ShowInfo();
            }

            Person person2 = new Person(false, false, "st.Adremak 6 - 89", "Pavel", "Grentrey", "Greece", DateTime.Parse("19.03.2018"));

            Console.WriteLine(person2);

            Person person3 = new Person(20, true, false, "st.Kolj 13 - 87", "Ariana", "Themy", "France", DateTime.Parse("13.07.2000"));

            Console.WriteLine(person3);

            Person.GetPeopleNum();
            People obj = new People(13);

            Console.WriteLine(obj);

            Person someone = new Person();

            someone = obj.findYoungest();
            Console.WriteLine(someone);
            Console.WriteLine();

            VolleyballPlayer vp = new VolleyballPlayer();

            vp.GenVolleyballPlayer();
            Console.WriteLine(vp);
            vp.Attack();
            vp.ShowStatus();

            Console.WriteLine();
            Console.WriteLine();

            TennisPlayer tp = new TennisPlayer();

            tp.GenTennisPlayer();
            Console.WriteLine(tp);
            tp.Attack();
            tp.ShowStatus();

            Console.WriteLine();

            HandballPlayer hp = new HandballPlayer();

            hp.GenPlayer();
            Console.WriteLine(hp);
            hp.ShowTeamMembers();
            int count = 0;

            while (count++ < 10)
            {
                hp.Attack();
            }
            hp.ShowStatus();

            Console.WriteLine();
            Console.WriteLine();

            Sportsman volleyBallPlayer = new VolleyballPlayer(true, false, "st.Nemanskaya 6-13", "Tanusha", "Shurko", "Belarus", new DateTime(2002, 07, 28), Sportsman.TypesOfSports.Volleyball, 0, 0, false, false, VolleyballPlayer.Teams.Minchanka, VolleyballPlayer.Position.Libero, "Max Nevero", 10);

            Console.WriteLine(volleyBallPlayer);

            volleyBallPlayer.ShowStatus();
            volleyBallPlayer.Attack();

            volleyBallPlayer.ShowCharacterTraits();
            volleyBallPlayer.GenCharacterTraits();

            ICharacterTraitsForSportsman inter = volleyBallPlayer;

            inter.GenCharacterTraits();
            inter.ShowCharacterTraits();

            volleyBallPlayer["Motivation"] = 100;

            Console.WriteLine(vp.CompareTo(volleyBallPlayer));
            Console.WriteLine(volleyBallPlayer.CompareTo(volleyBallPlayer));
            Console.WriteLine(volleyBallPlayer.CompareTo(vp));
            inter.ShowCharacterTraits();

            IPlayer ipl = vp;

            ipl.ShowHitAccuracy();

            TennisPlayer.RegisterHandler(TennisPlayer.UpdatePosition);

            TennisPlayer.HitAccuracy = 23;
            TennisPlayer.HitAccuracy = 58;

            Console.WriteLine(hp.HitAccuracy);
            hp.hitHandler += (int newAccuracy) => {
                Console.WriteLine($"Changed hit accuracy from {hp.HitAccuracy} to {newAccuracy}");
                hp.HitAccuracy = newAccuracy;
            };
            int j = 5;

            while (--j > 0)
            {
                hp.Attack();
            }
            hp.hitHandler += (int newAccuracy) => {
                hp.HitAccuracy++;
            };
            hp.Attack();

            vp.hitHandler += (int newAccuracy) => {
                if (newAccuracy > vp.HitAccuracy)
                {
                    Console.WriteLine($"Double hit accuracy from {vp.HitAccuracy} to {vp.HitAccuracy * 2}");
                    vp.HitAccuracy *= 2;
                }
                else
                {
                    Console.WriteLine($"Double hit accuracy from {vp.HitAccuracy} to {vp.HitAccuracy / 2}");
                    vp.HitAccuracy /= 2;
                }
            };

            vp.hitHandler += (int newAccuracy) => {
                if (vp.HitAccuracy > newAccuracy)
                {
                    Console.WriteLine($"Changed hit accuracy from {vp.HitAccuracy} to {vp.HitAccuracy + 1}");
                    vp.HitAccuracy++;
                }
                else
                {
                    Console.WriteLine($"Changed hit accuracy from {vp.HitAccuracy} to {vp.HitAccuracy - 1}");
                    vp.HitAccuracy--;
                }
            };
            vp.Attack();
            vp.Attack();
            vp.Attack();

            Console.WriteLine();
            volleyBallPlayer.ShowEverything();

            Person iXPerson = obj[13];

            obj[-1]   = someone;
            obj[1000] = someone;

            volleyBallPlayer["smth"]        = 13;
            volleyBallPlayer["persistance"] = 19063;
        }
Esempio n. 3
0
        static void Main(string[] args)
        {
            Person.GetPeopleNum();

            Person person1 = new Person();

            person1.Name        = "Tanusha";
            person1.Surname     = "Shurko";
            person1.Age         = 18;
            person1.Sex         = true;
            person1.HomeAddress = "st. Nemanskaya 9-78";
            person1.Marriage    = false;
            person1.Country     = "Belarus";
            person1.DateOfBirth = DateTime.Parse("28.07.2002");
            person1.ShowInfo();

            Console.WriteLine();

            Person[] people = new Person[10];
            for (int i = 0; i < people.Length; i++)
            {
                people[i] = new Person();
                people[i].GenFields();
                people[i].ShowInfo();
            }

            Person person2 = new Person(false, false, "st.Adremak 6 - 89", "Pavel", "Grentrey", "Greece", DateTime.Parse("19.03.2018"));

            Console.WriteLine(person2);

            Person person3 = new Person(20, true, false, "st.Kolj 13 - 87", "Ariana", "Themy", "France", DateTime.Parse("13.07.2000"));

            Console.WriteLine(person3);

            Person.GetPeopleNum();
            People obj = new People(13);

            Console.WriteLine(obj);

            Person someone = new Person();

            someone = obj.findYoungest();
            Console.WriteLine(someone);
            Console.WriteLine();

            Person iXPerson = obj[13];

            obj[-1] = someone;
            obj[0]  = someone;
            Console.WriteLine(obj);

            VolleyballPlayer vp = new VolleyballPlayer();

            vp.GenVolleyballPlayer();
            Console.WriteLine(vp);
            vp.Attack();
            vp.ShowStatus();

            Console.WriteLine();
            Console.WriteLine();

            Sportsman volleyBallPlayer = new VolleyballPlayer(true, false, "st.Nemanskaya 6-13", "Tanusha", "Shurko", "Belarus", new DateTime(2002, 07, 28), Sportsman.TypesOfSports.Volleyball, 0, 0, false, false, VolleyballPlayer.Teams.Minchanka, VolleyballPlayer.Position.Libero, "Max Nevero", 10);

            Console.WriteLine(volleyBallPlayer);

            volleyBallPlayer.ShowStatus();
            volleyBallPlayer.Attack();

            Console.WriteLine();
            Console.WriteLine();

            TennisPlayer tp = new TennisPlayer();

            tp.GenTennisPlayer();
            Console.WriteLine(tp);
            tp.Attack();
            tp.ShowStatus();

            Console.WriteLine();

            HandballPlayer hp = new HandballPlayer();

            hp.GenPlayer();
            Console.WriteLine(hp);
            hp.ShowTeamMembers();
            int count = 0;

            while (count++ < 10)
            {
                hp.Attack();
            }
            hp.ShowStatus();
        }