java-coding-6
Do you need academic writing help with your homework? Let us write your papers.
Order a Similar Paper
Order a Different Paper
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 deadlines
Order Paper Now1. 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.