You are modelling the different vehicles operated by the public transportation agency of your home city. Design a class named Vehicle and its two subclasses named RailVehicle and BusVehicle. A Vehicle has a unique ID. Make TrainCar and MetroCar subclasses of RailVehicle, given the information that train cars are arranged in a chain to form a single train on which only certain cars have a driver, whereas metro cars are typically one long driverless vehicle driven by a computer system. Define relevant attributes for the BusVehicle class, identifying characteristics of buses that rail vehicles do not have (if you are not sure, ask a friend or read about Buses). Override the toString method in each class, and write a test program to display the exact output as follows: TEXT 1 This is a Vehicle, with unique ID = E7BC This is a Vehicle, with unique ID = BB77 3 This is a RailVehicle, with unique ID = 120B This is a TrainCar, in chain 721X5, with no driver 5 This is a TrainCar, in chain 721X5, with no driver 6 This is a TrainCar, in chain 721X5, with driver 7 This is a MetroCar, automated under route plan 470 8 This is a MetroCar, automated under route plan 47R 9 This is a BusVehicle, with unique ID = 12AA If you have completed this question, go back to your code and think about how you could make use of the concept of polymorphism in this question. Try coding it and discuss with your tutor your approach.+ A Vehicle.java . RailVehicle.java BusVehicle.java TrainCar.java MetroCar.java . Exercise1.java 1 public class Exercisel { 2 / / This is just for your testing - we will run your classes against our own tests 3 / / Make sure you have the correct toString for all classes 4 public static void main (String args) { 5 6 ArrayList
vehicles = new ArrayList( ) ; 7 vehicles . add (new Vehicle() ) ; 8 LD / / continue here. .. 10 11 12 }