private void button1_Click(object sender, EventArgs e) { Vehicle V = new Vehicle(); Bicycle Bike = new Bicycle(true, "Red", 21); BicycleLabel.Text = Bike.ToString(); MotorBike MBike = new MotorBike("Green", 1600, "Fork"); MotorBikeLabel.Text = MBike.ToString(); Car C = new Car("Red", 2000, 5); CarLabel.Text = C.ToString(); Total.Text = "There are " + Convert.ToString(V.GetCount()) + "Vehicles"; }
static void Main(string[] args) { Bicycle b = new Bicycle("Hero", 2000, "Youngster", 30); Bike bk = new Bike("Yamaha", 2014, "FZ", 50); Car c = new Car("Maruti", 2015, "Dzire", 60); Truck t = new Truck("Tata", 2013, "1613", 40); b.setBycycleColor(); bk.setBikeType(); c.setCarBodyType(); t.setTruckLoadingCapacity(); Console.WriteLine(""); Console.WriteLine("Bicycle details are"); Console.WriteLine("Bike Maker " + bk.make); Console.WriteLine("Bike Manufacture year " + bk.yearOfManufacture); Console.WriteLine("Bike Model " + bk.model); Console.WriteLine("Bike Speed " + bk.speed); bk.accelerate(); bk.deaccelarate(); bk.isMoving(); bk.stop(); bk.getBikeType(); Console.WriteLine("Bike details are"); Console.WriteLine(""); Console.WriteLine("Bcycle Maker " + b.make); Console.WriteLine("Bcycle Manufacture year " + b.yearOfManufacture); Console.WriteLine("Bcycle Model " + b.model); Console.WriteLine("Bcycle Speed " + b.speed); b.accelerate(); b.deaccelarate(); b.isMoving(); b.stop(); b.getBycycleColor(); Console.WriteLine(""); Console.WriteLine("Car details are"); Console.WriteLine("Car Maker " + c.make); Console.WriteLine("Car Manufacture year " + c.yearOfManufacture); Console.WriteLine("Car Model " + c.model); Console.WriteLine("Car Speed " + c.speed); c.accelerate(); c.deaccelarate(); c.isMoving(); c.stop(); c.getCarBodyType(); Console.WriteLine(""); Console.WriteLine("Truck details are"); Console.WriteLine("Truck Maker " + t.make); Console.WriteLine("Truck Manufacture year " + t.yearOfManufacture); Console.WriteLine("Truck Model " + t.model); Console.WriteLine("Truck Speed " + t.speed); t.accelerate(); t.deaccelarate(); t.isMoving(); t.stop(); t.getTruckLoadingCapacity(); Console.ReadLine(); }