Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

IN JAVA Program Specification: You are to design and implement a set of exactly six classes which can be used to model the need of

IN JAVA

Program Specification: You are to design and implement a set of exactly six classes which can be used to model the need of a vehicle manufacturer to preform an inventory for tax purposes.

Vehicle which must be abstract, and has only the following instance variables: vin - a unique identification number cost - the wholesale cost that the vehicle is sold for gasoline - true if it is gasoline powered / false otherwise

Car - which extends Vehicle, and has only one instance variable: weight - The gross weight of the car (in Tons) All Cars also have four wheels.

Sled - which extends Vehicle but may have no additional instance nor class data variables. All Sleds do have three wheels however.

Cycle - which extends Vehicle but may have no additional instance nor class data variables. All Cycles do have two wheels however.

Inventory - which is an aggregation of Vehicles and supports the following functionality:

Create an empty inventory

Add a Vehicle to the inventory

Display in a complete and proper report format all the Vehicles in the inventory. (Hint: polymorphic call to actual Objects toString() method) Produce a total tax liability for the inventory based on the following criteria, applied to each Vehicle in the inventory:

? if gasoline powered : 0.06 * (cost + 100 * wheel count)

? otherwise: 0.04 * (cost + 100 * wheel count) In addition, each car with a gross weight over 1 Ton is charged an additional $200 road tax.

Driver - A class which must fully test all of the above classes correctness and functionality.

Rules and Requirements:

When designing your classes you must use Inheritance and Aggregation correctly to Enforce the defining characteristics above.

For each class (other than Driver): You may not include additional instance nor class data variables. You must include an appropriate specifying or default constructor and in derived classes, the corresponding super constructor must be utilized.

All access of instance variables (within each class), by the other instance methods must be made via the classes accessor(s) and/or mutator(s).

You must include a toString() and equals(object guest) which correctly overrides their super classs version.

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_2

Step: 3

blur-text-image_step3

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

More Books

Students also viewed these Databases questions