public Tri(string nature, int distanceNatation, int distanceVelo, int distanceCourse) { this.nature = nature; this.natation = new Epreuve("Natation", distanceNatation); this.velo = new Epreuve("Velo", distanceVelo); this.course = new Epreuve("Course", distanceCourse); lesParticipant = new List <Participant>(); }
public void Add(Epreuve uneEpreuve, int tempsRealise) { if (ResultatPresent(uneEpreuve) == false) { Resultat unResultat = new Resultat(this, uneEpreuve, tempsRealise); lesResultats.Add(unResultat); } }
public bool ResultatPresent(Epreuve uneEpreuve) { foreach (Resultat unTesultat in lesResultats) { if (unTesultat.GetEpreuve().GetNom() == uneEpreuve.GetNom()) { return(true); } } return(false); }
static void Main(string[] args) { Tri ttiii = new Tri("XL", 20, 32, 45); DateTime date = DateTime.Parse("01/11/2018"); Participant ppaa = new Participant("leo", date); ttiii.AddParticipant(ppaa); Epreuve eppleo = new Epreuve("natation", 220); ttiii.GetParticipantById(0).Add(eppleo, 200); Epreuve eppleo1 = new Epreuve("velo", 800); ttiii.GetParticipantById(0).Add(eppleo1, 800); Epreuve eppleo2 = new Epreuve("course", 400); ttiii.GetParticipantById(0).Add(eppleo2, 400); DateTime datee = DateTime.Parse("01/01/2018"); Participant ppaaa = new Participant("eol", date); ttiii.AddParticipant(ppaaa); Epreuve eppeol = new Epreuve("natation", 220); ttiii.GetParticipantById(1).Add(eppeol, 220); Epreuve eppeol1 = new Epreuve("velo", 800); ttiii.GetParticipantById(1).Add(eppeol1, 800); Epreuve epp = new Epreuve("natation", 220); Epreuve epp1 = new Epreuve("course", 400); Epreuve epp2 = new Epreuve("velo", 800); foreach (Resultat unResultat in ttiii.GetParticipantById(1).LesResultats) { if (ttiii.GetParticipantById(1).ResultatPresent(epp)) { Console.WriteLine("Le resultat est present"); } else { if (ttiii.GetParticipantById(1).ResultatPresent(epp1)) { Console.WriteLine("Le resultat est present"); } else { if (ttiii.GetParticipantById(1).ResultatPresent(epp2)) { Console.WriteLine("Le resultat est present"); } else { Console.WriteLine("Le resultat n'est present"); } } } } if (ttiii.GetParticipantById(0).HorsDelai()) { Console.WriteLine("Vous etes hors delai"); } else { Console.WriteLine("Vous etes dans les temps"); } if (ttiii.GetParticipantById(1).HorsDelai()) { Console.WriteLine("Vous etes hors delai"); } else { Console.WriteLine("Vous etes dans les temps"); } Console.WriteLine(ttiii.GetParticipantById(1).GetId()); Console.WriteLine(ttiii.GetParticipantById(0).GetId()); Console.ReadLine(); }
public Resultat(Participant unParticipant, Epreuve uneEpreuve, int tempsRealise) { this.uneEpreuve = uneEpreuve; this.unParticipant = unParticipant; this.tempsRealise = tempsRealise; }