Java coding

Java coding

ANSWER MUST BE TYPED (or PASTED) ON THIS ASSIGNMENT SHEET

Defining Subclasses in Java

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.

"You need a similar assignment done from scratch? Our qualified writers will help you with a guaranteed AI-free & plagiarism-free A+ quality paper, Confidentiality, Timely delivery & Livechat/phone Support.


Discount Code: CIPD30



Click ORDER NOW..

order custom paper