Beispiel #1
0
 // возвращает среднее арифметическое количество очков определенного пилота.
 public double GetAvgPoints(Pilot obj)
 {
     try
     {
         int[] finded_pilot_points = FindPilot(obj).Points;
         int[] points_arr          = new int[RaceNumber];
         for (int i = 0; i < points_arr.Length; i++)
         {
             points_arr[i] = finded_pilot_points[i];
         }
         return(points_arr.Average());
     }
     catch (Exception)
     {
         throw;
     }
 }
Beispiel #2
0
 private Pilot FindPilot(Pilot obj)
 {
     try
     {
         Pilot[] pilots_arr = GetAllPilots();
         for (int i = 0; i < pilots_arr.Length; i++)
         {
             if (pilots_arr[i].Name.Contains(obj.Name))
             {
                 return(pilots_arr[i]);
             }
         }
         throw new ApplicationException($"\nNo such Pilot! :\n{obj}");
     }
     catch (ApplicationException)
     {
         throw;
     }
     catch (Exception)
     {
         throw;
     }
 }
Beispiel #3
0
 public Team(string title, string name1, short age1, string name2, short age2)
 {
     this.Title  = title;
     this.Pilot1 = new Pilot(name1, age1, title);
     this.Pilot2 = new Pilot(name2, age2, title);
 }
Beispiel #4
0
 public Team(string title, Pilot pilot1, Pilot pilot2)
 {
     this.Title  = title;
     this.Pilot1 = pilot1;
     this.Pilot2 = pilot2;
 }