public static void Main(string[] args) { var vehicles = new List <IVehicle> { new Minivan(5, "BMW", 1), new Van( 100, 100000, new Insurance(DateTime.Now, DateTime.Now, "Yuliia Nechyporuk"), "Lada", 10, 12000), new Minivan(5, "Kalina", 15), new Bicycle() }; foreach (IVehicle car in vehicles) { Console.Write(car.Name + " "); Console.WriteLine("Speed: " + car.GetSpeed()); } IVehicle van = new Van( 100, 100000, new Insurance(DateTime.Now, DateTime.Now, "Yuliia Nechyporuk"), "Lada", 10, 12000); van.PrintInfo(); }
public static void Main(string[] args) { var vehicle1s = new List <IVehicle1> { new Minivan(5, "BMV", 1), new Minivan(5, "Kalina", 15), new Bus(25, "ORN", 333), new Bike(), new Train(), new Van( 100, 100000, new Insurence(DateTime.Now, DateTime.Now, "Valeriia"), "Lada", 10, 12000), }; foreach (IVehicle1 car in vehicle1s) { Console.WriteLine(car.Name + " "); Console.WriteLine("Speed: " + car.GetSpeed()); } IVehicle1 van = new Van( 100, 100000, new Insurence(DateTime.Now, DateTime.Now, "Valeriia"), "Lada", 10, 12000); van.PrintInfo(); }
public static void Main(string[] args) { var vehicles = new List <IVehicle> { new MinivanChild(5, "BMW", 1, 888888), new Van( 100, 100000, new Insurance(DateTime.Now, DateTime.Now, "Oleh Harmash"), "Lada", 10, 999999), new MinivanChild(5, "Kalina", 15, 888888), new Bicycle(), new MinivanChildDouble(5, "BMW", 1, 111), new MinivanChildDouble(5, "BMW", 1, 222) }; var casteMinivanDouble = vehicles.Last() as MinivanChild; //var casteMinivanChild = vehicles.Last() as MinivanChildDouble; var castedBisycle = vehicles.Last(); foreach (IVehicle car in vehicles) { Console.Write(car.Name + " "); Console.WriteLine("Speed: " + car.GetSpeed()); } IVehicle van = new Van( 100, 100000, new Insurance(DateTime.Now, DateTime.Now, "Yuliia Nechyporuk"), "Lada", 10, 12000); van.PrintInfo(); }
public static void Main(string[] args) { var vehicles = new List <IVehicle> { new Van(10, 250, new Insurance(DateTime.Now, DateTime.Now, "Elena"), "Van", 12345, 1200), new Minivan(40, "Minivan", 3546, 20000), new Bicycle() }; foreach (var car in vehicles) { Console.WriteLine(car.Name + " "); Console.WriteLine("Speed :" + car.GetSpeed()); } IVehicle van = new Van( 100, 100000, new Insurance(DateTime.Now, DateTime.Now, "Yuliia Nechyporuk"), "Lada", 10, 12000); van.PrintInfo(); IVehicle plane = new Airplane(); plane.Price = 300; plane.PrintInfo(); IDiscounts plane1 = new Airplane(); plane1.GetSale(); Console.ReadKey(); }