Create a new Java project called usernamePart1 in NetBeans. In my case the project would be called rghanbarPart1. Select the option to create a main method.
Create a new class called Vehicle. In the Vehicle class write the code for:
In the main method write the code to:
Create a new Java project called usernamePart2 in NetBeans. Select the option to create a main method.
Create a new class called Car. Create a second class called Vehicle. Copy the code from the Vehicle class you created in Part 1 into the new Vehicle class.
Modify the new Car class so that it extends Vehicle (Vehicle is the superclass, Car is the subclass).
In the Car class write the code for:
In the main method write the code to:
Please note that collections are covered in Topic 3 and 4. You may need to wait until we have covered these topics to implement your ArrayList.
Polymorphism
In the class that contains the main method, create a second method that takes a Vehicle as a parameter and write the code to print out the vehicle's fuel type using one of the vehicles accessor methods. Then create an object of type Car and an object of type Vehicle in the main method and use the method you have just created to demonstrate polymorphism.
Create a new Java project called usernamePart3 in NetBeans. Select the option to create a main method.
Create a new class called Car. Create a second new class called Vehicle. Rewrite your code from Part2 so that:
All methods, constructors and instance variables that were in the Car and Vehicle classes in part 2 must be included in part 3. You need to rewrite the Car and Vehicle classes from part 2 so that Vehicle is abstract and there are multiple ways to create a Car.
Check your code works by creating a new Car in your main method.
Create a new Java project called usernamePart4 in NetBeans. Select the option to create a main method.
Create a new class called Car. Create a new interface called Vehicle. Rewrite your code from Part 2 so that:
All methods, constructors and instance variables that were in the Car and Vehicle classes in part 2 must be included in part 4. You need to rewrite the Car and Vehicle classes from part 2 so that Vehicle is an interface and there are multiple ways to create a Car.
In the main method of your project write the code to:
Create a word document called usernamePart5. Draw 2 UML diagrams to show the inheritance relationship for the Vehicle and Car in part 3 and part 4. Make sure that each diagram has a heading and the header of the word document contains your name and student ID.