Assigned | Wednesday February 16, 2005 |
Design Due | Sunday February 20, 2005 |
Program Due | Sunday February 27, 2005 at 11:59pm |
Updates |
In this first project, you will be asked to do some calculations related to renting a car. In particular, you will be calculating the car rental fee and the car insurance premium. These calculations are based on the tables below.
Weekly Charge | Daily Charge | Mileage Charge | |
---|---|---|---|
GOLD Card Member | $150.00 | $30.00 | First 200 miles FREE
$0.20 per mile over 200 miles |
PLATINUM Card Member | $100.00 | $20.00 | First 250 miles FREE
$0.12 per mile over 250 miles |
Under 25 | 25 and Over | |
---|---|---|
GOLD Card Member | $15.00 | $10.00 |
PLATINUM Card Member | $8.00 | $6.00 |
Note - A full weekly premium must be paid for a partial week.
Insurance premiums are NOT prorated. |
The output from your program must include all user inputs and the results of your calculations. You may provide any reasonable tabular output format. One possible format is provided here. Your output must meet the following requirements
Let's say the Bob Smith (Gold card member, age 30) rents one of our cars for 10 days and drives 650 miles.
For purposes of rental calculations, 10 days = 1 week + 3 days
For purposes of insurance calculations, 10 days = 2 weeks
Daily Rental Cost = 150 + 3 * 30 = 240
Mileage Cost = (650 - 200) * 0.20 = 450 * 0.20 = 90
Insurance Cost = 2 * 10 = 20
Grand Total Rental Cost = 240 + 90 + 20 = $350
Example 2
Let say Mary Jones (Platinum card member, age 20) rents a car for 18 days and drive 880 miles.
For purposes of rental calculations, 18 days = 2 weeks + 4 days
For purposes of insurance calculations, 18 days = 3 weeks
Daily Rental Cost = 2 * 100 + 4 * 20 = 280
Mileage Cost = (880 - 250) * 0.12 = 630 * 0.12 = 75.60
Insurance Cost = 3 * 8 = 24
Grand Total Rental Cost = 280 + 75.60 + 24 = $379.60
The "make" utility is used to help control projects with large numbers of files. It consists of targets, rules, and dependencies. You will be learning about make files in discussion. For this project, the makefile will be provided for you. You will be responsible for providing makefiles for all future projects. Copy the file makefile from Ms. Wortman's public directory to your directory.
When you want to compile and link your program, simply type the command make or make Proj1 at the Linux prompt. This will compile all necessary .cpp files and create the executable named Proj1.
The make utility can also be used for compiling a single program without linking. For example, to compile Proj1.cpp, type make Proj1.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 files, Proj1 executable 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.