CS 15-121 Introduction to Data Structures Lab 3 1. Create an java project class called "FactoryPatternExample". 2. Next, create a package called "factorypattern", make sure to have all your classes and interfaces in this package. An interface similar to a class in java, except that it can only contain method signatures and fields, it cannot contain implementations of methods. Create an interface called "Vehicle", which has the abstract method "move" with the following signature: public void move() An abstract method is a method which contains no _______. 3. Next, create the class "Car". This class should implement the above interface, and provide a body for the method "move". The "move" method should simply print the statement "A car runs on roads" to the console when invoked. 4. Create a class called "Aircraft", which also implements ""Vehicle. The "move" method for this class should print "An aircraft flies in the air" when invoked. 5. Lastly, create a class called "Train", implementing "Vehicle". The "move" method for this class should print the sentence "A train runs on rails". 6. Why do we use interfaces? _________. 7. Create a class called "CreateVehicles", which will have the "main" method. In the main method, create an object of each type of Vehicle(Car,Aircraft and Train) and call the move method on these objects. 8. In the above step, you saw one way of creating objects of different types in java. Next, we move to creating objects using the Factory Pattern. A factory class creates instances of other classes. All these classes typically share a common interface. 9. Create a class called "VehicleFactory". This class has a method called "getVehicle" with the following signature: public static Vehicle getVehicle(String criteria) For the above method, the return type is _____. And the input parmeter is _____. This method should return an object of a type of vehicle based on the value of criteria. Value Returntype road Car rail Train air Aircraft (Hint: You can use the if statement to compare the value of criteria and use the return statement to return a new object). If the criteria does not match, return a Car object by default. 10. Go back to the "CreateVehicles" class and create three different types of Vehicle objects by invoking the "getVehicle" method of the VehicleFactory class. Name them car, train and airplane. Call the move method on each one of them. 11. In addition to the "move" method, add one more method to the Vehicle interface. This method may be called anything of your choice, but remember that each of the classes implementing it should have different behavior to it(you can make the method print different statements for different classes). Call the new method with objects of different types in the "CreateVehicles" class.