ANSWER MUST BE TYPED (or PASTED) ON THIS ASSIGNMENT SHEET
Defining Subclasses in Java
Save your time - order a paper!
Get your paper written from scratch within the tight deadline. Our service is a reliable solution to all your troubles. Place an order on any task and we will take care of it. You won’t have to worry about the quality and deadlinesOrder Paper Now
1. Define a Vehicle class that contains instance variables for the following:
â€¢ Vehicle make and model (e.g., Honda Odyssey), as one string
â€¢ Vehicle year
â€¢ Miles per gallon
In addition, an appropriate constructor and getter methods should be defined, as well as a
toString method that returns a string of the form
â€œ2014 Honda Odyssey, 28 mpgâ€
2. Define two subclasses of the Vehicle class, PassengerVehicle and MovingVan, such thatPassengerVehicle objects contain (in addition to the above information) how many passengers it holds, and MovingVan objects contain (in addition to the above information) how many rooms storage it can hold. Each of these classes should also have an appropriate constructor, toString and getter methods defined.