Exemplo n.º 1
0
        private static void AssigneSwimmersToClubs(Registrant swimmer1, Registrant swimmer2, Registrant swimmer3, Club club1, Club club2)
        {
            Console.WriteLine("*******Adding swimmers to clubs ******\n***********************************");

            club1.AddSwimmer(swimmer1);
            DisplayInfo("club1", club1);
            DisplayInfo("swimmer1", swimmer1);

            club2.AddSwimmer(swimmer2);
            DisplayInfo("club2", club2);
            DisplayInfo("swimmer2", swimmer2);

            try
            {
                swimmer2.Club = club1;
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }

            try
            {
                swimmer3.Club = club1;
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
            DisplayInfo("swimmer3", swimmer3);
            DisplayInfo("club1", club1);
        }
 public void Add(Club club)
 {
     Clubs.Add(club);
     numberOfClubs++;
 }