Question: Design and implement these 4 files: 1. A parent class called Vehicle with description (eg Toyota Corolla) and year (eg 2018) attributesyear should be an

Design and implement these 4 files:
1. A parent class called Vehicle with description (eg Toyota Corolla) and year (eg 2018) attributesyear should be an integer
2. Car inherits from Vehicle and adds a type attribute (eg 2 door, 4 door sedan, hatchback, etc)
3. Truck inherits from Vehicle and adds a cargo bed attribute (eg 4 foot, 6 foot, etc)
4. A driver file to test the 3 classes above.
The classes described in #1, 2 and 3 above should have the usual constructors (default and parameterized), get (accessor) and set (mutator) methods for each attribute, and a toString method
Child classes should call parent methods whenever possible to minimize code duplication.
The driver program must test all the methods in each of the classes. Include comments in your output to describe what you are testing, for example System.out.println(testing Vehicle toString, accessor and mutator);. Print out some blank lines in the output to make it easier to read and understand what is being output.
Assignment Submission:
Submit a print-out of each class file, the driver file and a sample of the output.
Marking Checklist
1. Does EACH class have all the usual methods?
2. Are all methods in EACH class tested, including child objects calling inherited parent methods?
3. Does the child class call the parents constructor?
4. Does the child class override the parents toString?
5. Does the output produced have lots of comments explaining what is being output?
6. Does each class, and the output, have blank lines and appropriate indenting to make them more readable?

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!