Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Beginning C# 5.0 Databases

Authors: Vidya Vrat Agarwal

2nd Edition

1430242604, 978-1430242604

More Books

Students also viewed these Databases questions

Question

How severe is your handicap?

Answered: 1 week ago

Question

x-3+1, x23 Let f(x) = -*+3, * Answered: 1 week ago

Answered: 1 week ago

Question

2. What do you believe is at the root of the problem?

Answered: 1 week ago