예제 #1
0
 public void AddCoach(Coach coach)
 {
     if (coach.Club == null)
     {
         throw new Exception("Coach is not assigned to the club");
     }
     else if (coach.Club.ClubNumber != coach.Swimmers[numberOfRegistrants++].Club.ClubNumber)
     {
         throw new Exception("Coach and swimmer are not in the same club");
     }
     else
     {
         this.coach = coach;
     }
 }
예제 #2
0
 public void AddCoach(Coach coach)
 {
     if (numOfCoaches < maxCoaches)
     {
         Coaches[numOfCoaches++] = coach;
         coach.Club = this;
     }
     else
     {
         throw new Exception("Cannot add anymore coaches!");
     }
 }