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(); }
static void Main(string[] args) { new Puppy(); //var vehicles=new List<IVehicle> //var cars = new List<Car> var discounts = new List <IDiscount> { new Minivan(5, "BMW", 1), new Van( 100, 100000, new Insurance(DateTime.Now, DateTime.Now, "Nik NIk"), "Lada", 12000, 1000), new Minivan(5, "Kalina", 15), new Bike(5200) }; //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, "Yulia Nechyporuk"), "Lada", 10, 12000); //van.PrintInfo(); Console.WriteLine($"\t\nPrice with discount:"); foreach (var car in discounts) { car.PrintInfo(); Console.WriteLine(car.GetSale()); Console.WriteLine("\n"); } //foreach (var car in vehicles) //{ // Console.WriteLine("); //} }
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(); }