Project 3 Design
Due Date
- 11:59pm, Sunday, April 3, 2005
- No late designs accepted
Objective
The objective of this assignment is to make sure that you begin thinking
about your project in a serious way early. This will not only give you
experience doing design work, but will help you anticipate the number of
hours that you'll need to set aside to be able to complete the project.
The Assignment
Part I
Project 3 introduces two new car types to be rented by R & W.
With 3 types of cars and 2 types of customer cards, calculating the
rental fees and the insurance fees can become cumbersome. This is
especially true if you consider (as you should) that R & W may
introduce more car types and more customer card types in the future.
The first part of your assignment is to design a way to perform the calculations
which is easily extensible for more car and customer card types.
The naive solution of nested "if/else" statements shown below is
NOT acceptable since adding more car and/or customer card types adds more code.
Similarly, a combination of "if/else" and/or "switch/case" statements is also
NOT acceptable for the same reason.
// this code is NOT extensible and NOT acceptable
if (car type is ECONOMY)
{
if (card type is GOLD)
do ECONOMY/GOLD calculations
else if (card type is PLATINUM)
do ECONOMY/PLATINUM calculations
} else if (car type is MIDSIZE) {
if (card type is GOLD)
do MIDSIZE/GOLD calculations
else if (card type is PLATINUM)
do MIDSIZE/PLATINUM calculations
} else if (car type is LUXURY) {
if (card type is GOLD)
do LUXURY/GOLD calculations
else if (card type is PLATINUM)
do LUXURY/PLATINUM calculations
}
Part II
PLATINUM customers may now rent multiple cars simultaneously.
When printing the list of customers, you must print all cars that rented by
each customer. When printing the list of cars, you must print the customer
who has rented the car. These two requirements mandate a "bi-directional
association" between the cars and the customers. I.e. the car "knows" about the
customer who rented it and the the customer "know" about the cars he has rented.
Part II of your assignment is to explain how you plan to implement this bi-directional
association. NOTE that keeping customer information in the car class
or keeping car information in the customer class is NOT acceptable.
You are asked to design this bi-directional car/customer association without storing any reference
to the car, info about the car, or car vector index/pointer in the customer
AND without storing any reference to the customer, customer info, or customer vector
index/pointer in the car. Such an approach duplicates information and code.
A template for your design document, p3design.txt,
is provided in Ms. Wortman's public directory. Copy that file
/afs/umbc.edu/users/d/a/dana3/pub/CMSC202/p3/p3design.txt
to your local directory and fill in the necessary information.
Submit your modified p3design.txt file to complete this assignment.
Grading
You p3design.txt file will count as 10% of your project 3 grade
(part of the Correctness). If this file is not submitted by its due date,
or if you submit a new version
after its due date, you will lose all 10 points.
Your p3design.txt file will be compared to the header file or files that you
submit when Project 3 is due. Minor changes to the design are allowed. A
minor change might be the addition of another function or two or changing the way in which one or two parameters are passed.
If there are major changes between the design document and the header files
that are part of the final project, you will lose 5 points. This would
indicate that you didn't give sufficient thought to your design before
beginning the implementation.