Ejemplo n.º 1
0
 public void DisplayBestDriverData()
 {
     Console.SetCursorPosition(0, 40);
     Console.WriteLine($"Coureur met de meeste punten    : {DriverPoints.GetBestDriverName()}");
     Console.WriteLine($"Coureur met de snelste tijd     : {DriverLapTime.GetBestDriverName()}");
     //laptime
     //points
 }
Ejemplo n.º 2
0
 public void GiveLapTimes(List <IParticipant> participants)
 {
     foreach (Driver driver in participants)
     {
         if (driver.LapTime != null)
         {
             DriverLapTime lptdriver = new DriverLapTime();
             lptdriver.Name = driver.Name;
             lptdriver.Time = driver.LapTime;
             DriverLapTime.AddItemToList(lptdriver);
         }
     }
 }
Ejemplo n.º 3
0
        public string GetBestDriverName(List <IDataTemplate> list) // IN AVERAGE LAP TIME
        {
            //get the driver with the best average lap time by dividing the total lap time by the amount of laps

            DriverLapTime bestedriver = new DriverLapTime();
            int           laps        = 3; //hardcoded, dont know how to reach lapsamount from here

            foreach (DriverLapTime driver in list)
            {
                int driverseconds = (int)driver.Time.TotalSeconds;
                int besteseconds  = (int)bestedriver.Time.TotalSeconds;

                if ((driverseconds / laps) > (besteseconds / laps))
                {
                    bestedriver = driver;
                }
            }
            return(bestedriver.Name);
        }