Economy | Midsize | Luxury |
---|---|---|
Assigned | April 11,2005 |
Design Due | 11:59pm on April 17, 2005 |
Program Due | 11:59pm on April 24, 2005 |
Updates |
All previous projects were centered on the calculations of rental and insurance charges. In project 2, there was just one generic car so one set of functions was sufficient. Project 3 expanded the car rental system to have multiple types of cars, but each car type used the same calculations for rental and insurance charges, so again, one set of functions was enough. In this project, we again expand the functionality of the car rental system by adding the concept of car maintenance - washing, waxing, changing the oil, rotating the cars, etc. As you'll see, all cars have some common type of maintenance, but different types of cars also have different types of maintenance. So unlike projects 2 and 3, you will not able to use the same functions for different car types. Given the need for different functions for different cars and the possibility or more car types in the future, the best design and implementation for this project must use inheritance and polymorphism.
To implement this project, you will create a hierarchy of cars as shown in the figure below. Each car subclass will override the necessary function(s) to perform the required car maintenance. Car maintenance in this project will be "performed" by simply printing an appropriate message indicating what kind of maintenance was performed.
Car Type | Card Type | Weekly Charge | Daily Charge | Mileage Charge |
---|---|---|---|---|
Economy | GOLD | $90.00 | $20.00 | First 100 miles FREE
$0.20 per mile over 100 miles |
PLATINUM | $80.00 | $15.00 | First 200 miles FREE
$0.12 per mile over 200 miles | |
Mid-Size | GOLD | $150.00 | $30.00 | First 200 miles FREE
$0.20 per mile over 200 miles |
PLATINUM | $100.00 | $20.00 | First 250 miles FREE
$0.12 per mile over 250 miles | |
Luxury | GOLD | $200.00 | $40.00 | First 250 miles FREE
$0.20 per mile over 250 miles |
PLATINUM | $150.00 | $25.00 | First 300 miles FREE
$0.12 per mile over 300 miles |
Car Type | Card Type | Under 25 | 25 and Over | |
---|---|---|---|---|
Economy | GOLD | $12.00 | $9.00 | |
PLATINUM | $6.00 | $4.00 | ||
Mid-Size | GOLD | $15.00 | $12.00 | |
PLATINUM | $8.00 | $6.00 | ||
Luxury | GOLD | $18.00 | $14.00 | |
PLATINUM | $10.00 | $8.00 | ||
Insurance premiums are NOT prorated. |
Maintenance Task | Car Type | Frequency |
---|---|---|
Wash, Wax, Vacuum | All Cars | Every Rental |
Replace Air Freshener | Economy | Every Rental |
Exterior Detailing | Luxury | Every 5th Rental |
Shampoo Upholstery | Luxury | Every 2nd Rental |
Oil Change | Economy | Every 9000 Miles |
MidSize | Every 6000 Miles | |
Luxury | Every 3rd Rental | |
Tire Rotation | Midsize | Every 5000 miles |
Refill Hot Tub | Luxury | Every Rental |
Disinfect Interior | Economy | Every 4th Rental |
Midsize | Every 2nd Rental |
You will implement C++ class which will be used by the main portion of your program.
Code from project 3 should be reusable in project 4.
Note that not all of the programming details have been spelled out for you. For example, the project description indicates that a customer balance due the company must be printed, but there's no specification about where that data should be stored. Also, the reservation system must keep track of which car is rented by whom, but there's no indication about how that should be done. This is intentional....you are required to give the project design serious thought before writing code.
For 10 points of extra credit, add the following functionality to your program.
You must provide the makefile for this project. Use the makefile you submitted for project 3 and modify it appropriately. If you don't change the names of the files from project 3, the changes will be minimal.
The graders will be typing the command make Proj4 when they grade your project. This command must cause all .cpp files to be compiled and the executable named Proj4 to be created.
The make utility can also be used for compiling a single program without linking. For example, to compile Box.cpp, type make Box.o.
In addition to compiling and linking your files, make can be used for maintaining your directory. Typing make clean will remove any extraneous files in your directory, such as .o files and core files. Typing make cleanest will remove all .o files, core, Proj4, and backup files created by the editor. More information about these commands can be found at the bottom of the makefile.
The grade for this project will be broken down as follows. A more detailed breakdown will be provided in the grade form you receive with your project grade.
You can check to see what files you have submitted by typing
More complete documentation for submit and related commands can be found here.
Remember -- if you make any change to your program, no matter how insignificant it may seem, you should recompile and retest your program before submitting it. Even the smallest typo can cause compiler errors and a reduction in your grade.
Avoid unpleasant surprises!
Be sure to use the submitmake and submitrun utilities provided for you to compile, link and run your program after you've submitted it.