Java
Java
ASSIGNMENT 1
4. Write a simple Vehicle class that has fields for (at least) current speed, current direction in
degrees, and owner name. Add a static field to your Vehicle class to hold the next vehicle
identification number, and a non-static field to the Vehicle class to hold each car's ID
number. Add two constructors to Vehicle: a no-arg constructor and one that takes an initial
owner's name. Add a changeSpeed method that changes the current speed of the vehicle to
a passed-in value and add a stop method that sets the speed to zero. Change Vehicle so that
it has an EnergySource object reference, which is associated with the Vehicle in its
constructor. EnergySource must be an abstract class, because a GasTank object's measure
of fullness will differ from that of a Battery object. Put an abstract empty method in
EnergySource and implement it in GasTank and Battery classes. Add a start method to
Vehicle that ensures that the energy source isn't empty. (UNIT II)
Note. You are instructed to execute the above two programs step by step, and note all the error
occurred during compilation and execution along with error description , locations of error and
Write how do you resolve it.