Пример #1
0
        public void GiveAvgSpeed(Track track, List <IParticipant> participants) //takes each roudntime and divides it by the track length
        {
            int tracklength = track.Sections.Count * 200;                       // length of one section is 200 meters

            foreach (Driver driver in participants)
            {
                DriverAverageSpeed avgspeeddriver = new DriverAverageSpeed();
                avgspeeddriver.Name  = driver.Name;
                avgspeeddriver.Speed = tracklength / driver.LapTime.Seconds; //meters per second
                DriverAverageSpeed.AddItemToList(avgspeeddriver);
            }
        }
Пример #2
0
        public string GetBestDriverName(List <IDataTemplate> list)
        {
            DriverAverageSpeed best = new DriverAverageSpeed();

            foreach (DriverAverageSpeed driver in list) //not correct
            {
                if (best.Speed < driver.Speed)
                {
                    best.Name  = driver.Name;
                    best.Speed = driver.Speed;
                }
            }
            return(best.Name);
        }