Esempio n. 1
0
        public static Sportsman SetSportsman()
        {
            Sportsman obj = new Sportsman();

            Console.Write("Enter name: ");
            obj.Name = Console.ReadLine();
            Console.Write("Enter the country: ");
            obj.Country = Console.ReadLine();
            Console.Write("Enter the age: ");
            obj.Age = CheckAge();
            Console.Write("Enter the sport: ");
            obj.Sport = Console.ReadLine();
            Console.Write("Enter the sport rank(1 - Junior3, 2 - Junior2, 3 - Junior1, 4 - Adult3, 5 - Adult2, 6 - Adult1, 7 - CMS, 8 - MS, 9 - IMS, 10 - HMS): ");
            obj.Rank = (Rank)CheckRank();
            Console.Write("Enter the name of competitions: ");
            obj.cmp.name = Console.ReadLine();
            Console.Write("Enter the date of copmetitions: ");
            obj.cmp.date = CheckDate();
            Console.Write("Make a contribution? (0 - no, 1 - yes): ");
            int cont = CheckCompetitions();

            if (cont == 0)
            {
                obj.Payment();
                return(obj);
            }
            Console.Write("Take a dope? (0 - no,  1 - yes): ");
            int dope = CheckCompetitions();

            if (dope == 0)
            {
                return(obj);
            }
            else
            {
                obj.Dope();
                return(obj);
            }
        }
Esempio n. 2
0
        static void Main(string[] args)
        {
            Sportsman sp = new Sportsman();

            Console.WriteLine(sp);
            Waiting();
            Sportsman[] list = new Sportsman[2];
            SetList(list);
            Waiting();
            Console.Clear();
            Console.WriteLine("Sorted list:");
            Array.Sort(list);
            foreach (Sportsman s in list)
            {
                Console.WriteLine(s);
            }
            Waiting();
            Console.WriteLine("Copy of the first sportsman in the list:");
            Sportsman obj = (Sportsman)list[0].Clone();

            Console.WriteLine(obj);
        }