static void Main(string[] args) { DateTime dateProductionManufacturer = new DateTime(1983, 1, 1); DateTime dateProductionSeller = new DateTime(2000, 1, 1); DateTime dateProductionCar = new DateTime(2018, 2, 1); DateTime currDate = new DateTime(2020, 2, 4); Manufacturer m = new Manufacturer("Kia Sorento Group", dateProductionManufacturer, 083456772, 40000); Seller s = new Seller("SellingCars", dateProductionSeller, 123, 95); Owner o = new Owner("Roman", 111); Console.WriteLine("------- Iнформацiя про автомобiль -------"); Automobile auto = new Automobile("Kia", "white", 1111, m, s, o, dateProductionCar); Console.WriteLine(auto); Console.WriteLine($"Вiк машини - {auto.GetAge(currDate)}"); }
static void Main(string[] args) { Car[] Cars = new Car[10]; for (int i = 0; i < Cars.Length/2; i++) { Console.WriteLine("Enter price and fuelconsumption:"); Cars[i] = new Automobile(); (Cars[i] as Automobile).Price = int.Parse(Console.ReadLine()); (Cars[i] as Automobile).FuelConsumption = int.Parse(Console.ReadLine()); (Cars[i] as Automobile).CarInfo(); } for (int i = Cars.Length/2; i < Cars.Length; i++) { Console.WriteLine("Enter price and is 4x4:"); Cars[i] = new SUV(); (Cars[i] as SUV).Price = int.Parse(Console.ReadLine()); (Cars[i] as SUV).HighlyPassable = bool.Parse(Console.ReadLine()); (Cars[i] as SUV).SUVInfo(); } }