Question: Java Main topics: Composition - Aggregation Inheritance Polymorphism & Abstarct Program Specification: You are to design and implement a set of exactly six classes which

Java

Main topics:

Composition - Aggregation

Inheritance

Polymorphism & Abstarct

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

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!