CPT295 - Assignment 1 (Due: Dec 2014)
FERRARI Plc, runs a business of providing storage space for car owners. FERRARI charges car owners for the use of his storage facility. There are different types of charges/levies imposed on each car’s storage. The conceptual model below shows FERRARI’s business.
The diagram indicates an abstract class called Car with instance attributes height, length, width,
carValue, and a static attribute of chargeRate. Class Car has an abstract method named totalMonthlyCharge, which returns the sum of all the different monthly storage charge/levy (explained below) incurred on each car. The computation of total monthly storage charge will be different for different types of cars.
Class F1Car extends class Car and adds the attribute of mastHeight and F1Area. Class MotorCar extends class Car and adds the attribute of horsePower. Class CarStorage has a collection of Car objects and a collection of Owner objects. Each Owner object has a unique idNumber attribute, a name, an address, and a collection of cars.
FERRARI charges a monthly storage fee on each car stored. Cars are stored in an enclosed, secure and covered facility. The amount charged is based on the car’s volume (in cubic metres), which is computed by multiplying the height, length and width of each car. The monthly fee is then determined by multiplying the volume with the chargeRate (per cubic metre). The majority of FERRARI’s income is from storage provision and management.
FERRARI also provides F1 drying facilities for F1 cars. A F1DryingCharge is therefore levied on all F1 car owners. This levy is found by determining 10% of the F1Area of each F1ing car. For example, if an individual F1ing car had a F1Area of 250 square metres; the F1DryingCharge for that car would be USD25 per month. You should decide (and justify) in which class you should place this F1Rate of 10%.

FERRARI needs to provide fire prevention strategies and firefighting capabilities to reduce his overall Indemnity insurance expense. To recover the cost of this expense Bond has decided to levy motor car owners an amount in dollars equal to 10% of the horse power applicable to that particular car. Thus if a power car was rated at 85 horse power, FERRARI would charge USD8.50 as a fire levy for that car per month.
The fireRate of 10% is an attribute that you should be looking to add to one of your classes. Again, you decide and justify the placement of this attribute.
FERRARI also levies owners an amount of 0.05% of the value of their car per month. This amount is used to provide owners with insurance against loss while the car is in storage. This procedure protects FERRARI as well as owners. A car worth USD250,000 would be levied an insurance amount of USD125 per month. The levyRate of 0.05% is an attribute that you should be looking to add to one of your classes. Again, you decide (and justify) the placement In implementing FERRARI’s Car Storage System, you must adhere to the relationships that exist between the different objects as depicted in the conceptual model shown above. FERRARI requires individual methods to determine the storageCharge, the fireLevyCharge, the F1DryingCharge and the insuranceLevy charge for ALL cars in storage for a nominated owner. FERRARI also requires a method called totalOwnerCharge that produces the sum (total) of the previous levies and charges for a nominated owner. FERRARI also needs overall statistics for these levies and charges.
FERRARI is interested in reviewing charges. He needs to be able to determine the total monthly income that he is raising from the different levies and charges. These methods will all be separate. It is your task to decide on the placement, access modifiers and functioning of these and other supporting methods.
Your task is to provide a Console interface that allows a user of your program to perform the following operations:
1. Add a new owner to the Car Storage system. This is achieved by providing the name and address of a new owner. Each owner is given a unique identifier. Thus when we create a new owner we provide them with a name, address and idNumber. Owner numbers commence at 1 and are continued sequentially.
2. Adding a car for a given owner. The system will need to be provided with a valid owner idNumber. The user has to choose between a F1ing car or a motor car. For a F1ing car, the system will be presented with the car height, width, length, value, mastHeight and F1Area. For a motor car, the system will request the car height, width, length, value and horsepower. Note that each car will need to be linked to the Car Storage system in addition to being linked to its owner. This is clearly shown by the conceptual model.
3. When provided with a valid idNumber display the storageCharges, F1DryingCharges, fireLevyCharges and the insuranceLevies for ALL cars belonging to the entered owner. This will enable FERRARI to produce monthly invoices for owners based on the cars belonging to that owner that are stored in FERRARI’s Car Storage.
4. Display a count of the number of F1 cars and a count of the number of motor cars that are currently at FERRARI’s Cars Storage.
5. Display the charges that are applicable to ALL cars that are currently in storage. This will include a summary display of the TOTAL storageCharges, F1DryingCharges, fireLevyCharges and the insuranceLevies that are applicable in total to ALL car owners for FERRARI’s business.

6. Display all car owners, (1) in the original order; (2) sorted according to owner’s name; or (3) sorted according to the total monthly storage charge.
7. Given a valid idNumber, update information of car(s) owned by the selected owner.

In completing this assignment you should carefully consider the design of EACH class. Once you have coded each class, test its functionality completely. Work from the base class up. Once you have the abstract Car class constructed and tested, work on the derived sub classes. Then construct the Owner and CarStorage classes.
Make exclusive use of 'getters' and 'setters' to access and alter ‘model’ attributes. You should consider the need to include overloaded or over-riding methods in the various classes. You will also need to give careful consideration to access modifiers that you use.
This model implementation for this assignment will be further used and extended in the next assignment. It is important that you design carefully before implementing. A flawed implementation may create problems for you in the second assignment.
Your consoled styled interface should allow the functionality specified above to be fully tested. Note again, NO GUI interface is required. It should be a console styled interface.
Your source code should contain javadoc comments and tags as follows:
• For classes, to indicate their purpose;
• For methods, to indicate their effect, parameters and return values, as well as any exceptions they throw;
• For fields, to indicate their purpose.

Assessment criteria Item Marks
Correct inheritance pattern for Car, F1Car, MotorCar classes. 20
Correct use of Java collection classes 20
Completion of all of the requirements that have been specified. 30
Program demonstrates correct summary information 20
Program style and readability, including Javadoc comments 10
Total marks 100