예제 #1
0
        //Este metodo recibe un objeto del tipo CocheSimple(puede ser: taxi, autobus o cochesimple) y lo añade a la lista
        public void AddParticipant(SeleccionFutbol participant)
        {
            if (MaximumParticipant(participant))
            {
                if (participant.GetType().Name == "Entrenador")
                {
                    numeroEntrenador++;
                }
                else if (participant.GetType().Name == "Masajista")
                {
                    numeroMasajista++;
                }

                participants.Add(participant);
            }
        }
예제 #2
0
 //boolean AltaSeleccion ( ) Allowed if there is room , to enlist a new member and
 public Boolean MaximumParticipant(SeleccionFutbol participant)
 {
     if (participants.Count < 30)
     {
         if (participant.GetType().Name == "Masajista" && numeroMasajista < 4)
         {
             Console.WriteLine("One more masseur is in the team");
             return(true);
         }
         else if (participant.GetType().Name == "Entrenador" && numeroEntrenador < 2)
         {
             Console.WriteLine("One more trainer is in the team");
             return(true);
         }
         else if (participant.GetType().Name == "Futbolista")
         {
             Console.WriteLine("One more player is in the team");
             return(true);
         }
     }
     return(false);
 }