示例#1
0
文件: Season.cs 项目: Marbax/C_Sharp
 // возвращает среднее арифметическое количество очков определенного пилота.
 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;
     }
 }
示例#2
0
文件: Season.cs 项目: Marbax/C_Sharp
 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;
     }
 }
示例#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);
 }
示例#4
0
 public Team(string title, Pilot pilot1, Pilot pilot2)
 {
     this.Title  = title;
     this.Pilot1 = pilot1;
     this.Pilot2 = pilot2;
 }