public void AddDriverToList() { Console.WriteLine("ADD NEW DRIVER TO LIST\n...\n..."); Console.WriteLine("Driver's LAST name?"); string driversLastName = Console.ReadLine(); Console.WriteLine("Driver's FIRST name?"); string driversFirstName = Console.ReadLine(); Console.WriteLine("Driver's average speed?"); float avgSpeed = float.Parse(Console.ReadLine()); Console.WriteLine("Driver's average stopping G's?"); float avgGForce = float.Parse(Console.ReadLine()); Console.WriteLine("Driver's average stop sign roll-throughs?"); float avgStopSignRollthrough = float.Parse(Console.ReadLine()); Console.WriteLine("Driver's average follow distance?"); float avgFollowDistance = float.Parse(Console.ReadLine()); Console.WriteLine("Driver's last accident?"); DateTime lastAccident = DateTime.Parse(Console.ReadLine()); DateTime today = DateTime.UtcNow; TimeSpan timeSinceLastAccident = today - lastAccident; CarData driver = new CarData(driversFirstName, driversLastName, avgSpeed, avgGForce, avgStopSignRollthrough, avgFollowDistance, timeSinceLastAccident); _repo.AddToList(driver); Console.WriteLine("Driver added to list."); }
public void PopulateList() { TimeSpan time = new TimeSpan(12000, 2, 2, 2, 2); TimeSpan timeTwo = new TimeSpan(45, 0, 0, 0, 0); TimeSpan timeThree = new TimeSpan(0, 45, 23); CarData driverOne = new CarData("Ed", "Harris", 23f, 1.2f, 1f, 35f, time); _repo.AddToList(driverOne); CarData driverTwo = new CarData("Michelle", "Rodrigues", 94f, 3.5f, 58f, 4f, timeTwo); _repo.AddToList(driverTwo); CarData driverThree = new CarData("Betty", "White", 123f, 10.1f, 1012, 1.3f, timeThree); _repo.AddToList(driverThree); }
public void AddToList(CarData carData) { _cars.Add(carData); }