public void InitMotorbikes(int size, List <Motorbike> motorbikes, Random rnd) { for (int i = 0; i < size; i++) { Motorbike bike = new Motorbike(); bike.Type = "Motorbike"; bike.ModelName = string.Format("{0}", rnd.Next(1, 10)); bike.Id = rnd.Next(1000, 9999); bike.MaxSpeed = rnd.Next(80, 350); bike.Carrying = rnd.Next(20, 100); motorbikes.Add(bike); } }
static void Main(string[] args) { Car car = new Car(); Motorbike motorbike = new Motorbike(); Track track = new Track(); User user = new User(); int userSize = user.UserSize(); List <Trans> transpotrs = new List <Trans>(); List <Car> cars = new List <Car>(); List <Motorbike> motorbikes = new List <Motorbike>(); List <Track> tracks = new List <Track>(); Random rnd = new Random(); Console.WriteLine(); Console.WriteLine("Машины"); Console.Write("Введите количество транспортных средств: "); car.InitCars(userSize, cars, rnd); car.Show(cars); Console.WriteLine(); Console.WriteLine("Мотоциклы"); Console.Write("Введите количество транспортных средств: "); motorbike.InitMotorbikes(userSize, motorbikes, rnd); motorbike.Show(motorbikes); Console.WriteLine("Грузовой автомобиль"); Console.Write("Введите количество транспортных средств: "); track.InitTracks(userSize, tracks, rnd); track.Show(tracks); Console.WriteLine(); Console.WriteLine(); }