UMBC CMSC 202
UMBC CMSC 202 CSEE | 202 | current 202

CMSC 202 Spring 2005
Project 2

R & W Car Rental Company

Assigned February 28, 2005
Design Due 11:59pm on March 6, 2005
Program Due 11:59pm on March 13, 2005
Updates

Objectives


Project Description

The R & W Car Rental Company has contracted you to develop a car rental system which allows the company to maintain a list of cars owned by the rental company and a list of customers who rent the cars. Currently the company rents only mid-size cars, but the company expects that other kinds of cars will available in the future, so your program must be easily modifiable. The car rental system must meet basic reporting and calculation requirements.

The car rental system

The car rental system must maintain information about each car the company owns, each customer who can rent a car, and information about which cars are currently rented. The basic functional requirements of the car rental system are detailed below.
  1. Add a new car to the rental system -- self explanitory.
  2. Add a new customer to the rental system - self explanitory
  3. Rent a car to a customer -- associate the car with the customer.
  4. Return a car.
    When a renter returns a car, the number of days and mileage driven are specified. The total rental cost is calculated (sound familiar?) and added to the customer's balance due to the company. A "receipt" is printed for the renter which contains all car rental information, all renter information and the breakdown of the rental cost. See the
    sample output below.
  5. Print a list of all cars.
    All available information about each car is printed. If a car is currently rented, all customer information for the renter is also printed.
  6. Print a list of customers
    All information about each customer (including balance due) is printed.
The R & W Car Rental Company has the following policies
  1. You must be 18 years old to rent a car.
  2. A customer can only rent one car at a time.

Cars

Cars rented by the R & W Car Rental Company for this project are the same as those described in project 1. Each car is described by its model (a string which may contain spaces) and uniquely identified by its license tag ( a string without spaces ). The calculations for car rental and insurance are the same as in project 1. The rental and insurance tables from project 1 are duplicated here for your convenience. See the project 1 specification for sample calculations.

Car Rental Schedule


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

Weekly Car Insurance Premiums


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.

Customers

Customers who rent cars from the R & W Car Rental Company in this project are basically the same as those described in project 1. Each customer has a name, age and membership card. Membership cards currently come in only two types, "GOLD" and "PLATINUM" and are imprinted with a unique 6-digit membership number in the form 12-3456.

Program Description

Your assignment is to write a program that simulates the rental car company reservation system described above. The main portion of your program will read commands from a file and perform the requested action (i.e. adding a car or customer, renting a car, returning a car, producing some output).

You will implement three C++ class which will be used by the main portion of your program. One class will be implemented to model the car reservation system, one class will model a car and one class will model a customer.

Code from project 1 should be reusable in project 2.

Program Requirements

General Requirements

  1. Your program must echo each command and command parameter read from the command file.
  2. The name of the command file will be the one and only command line argument.
  3. In keeping with course standards, main( ) will be implemented in a file named Proj2.cpp. The prototypes for any helper functions called from main will be located in Proj2Aux.h and the functions themselves implemented in Proj2Aux.cpp. Each class will be defined in a separate header (e.g. Car.h) file and implemented in a similarly named .cpp file (e.g. Car.cpp). You must provide a makefile for this project which compiles and links all files when the grader types make Proj2. Your executable must be named Proj2.

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.

Program Error Checking

Your program must provide adequate error checking in support of the policies of the car rental system listed above. In addition, invalid commands and any commands which cannot be carried out (i.e. trying to rent a car to a non-existent customer) must also result in an appropriate error message.

Program Output

Your program's output must adhere to the following requirements. See the
sample output below.
  1. Customer membership card numbers must be displayed in the form 12-3456.
  2. All monetary values must be displayed with 2 decimal places.
  3. When displaying a list of cars or customers, data must be aligned in columns.
  4. Renter names must be displayed last name first.
  5. Lists of cars/customers should be displayed in the order cars/customers are added to the rental system.
For purposes of formatting output only, you make the following assumptions which are the same as project 1.
  1. The renter's first and last name total no more than 20 characters.
  2. The car's model is no more than 20 characters.
  3. The car's license tag number is no more than 8 characters.
  4. Days rented and miles driven are less than 10000.
  5. The total rental charge is less than $100000.

The Command File

The command file has the following format. Each command and all of its parameters appear on one line. You may assume that valid commands are properly formatted and all data elements are the appropriate type. You may not assume all commands are valid. Blank lines may be found anywhere in the file and should be ignored.

The following sample command file was used to produce the sample output. CAR 123-ABC Honda CAR 124-xyz Your Honda PRINT CARS CUSTOMER Bob Smith 33 GOLD 123456 CUSTOMER Billy Smith 44 PLATINUM 654 PRINT CUSTOMERS RENT 124-xyz 123456 PRINT CARS RETURN 123-ABC 10 400 RETURN 124-xyz 20 300 PRINT CARS

Sample Output

This sample output was produced from the sample command file above. It is only a sample. It is not necessary that your output match the format exactly, but you must adhere to the
program output requirements above. linuxserver2[126] Proj2 p2.dat CMD: CAR, 123-ABC, Honda CMD: CAR, 124-xyz, Your Honda CMD: PRINT CARS Tag Model Renter ---------- --------------- ----------------------------------------- 123-ABC Honda 124-xyz Your Honda CMD: CUSTOMER, Bob, Smith, 33, GOLD, 123456 CMD: CUSTOMER, Billy, Smith, 44, PLATINUM, 654 CMD: PRINT CUSTOMERS Name Balance Due Age Card -------------------- ----------- --- ------------------ Smith, Bob 0.00 33 12-3456 / GOLD Smith, Billy 0.00 44 00-0654 / PLATINUM CMD: RENT, 124-xyz, 123456 CMD: PRINT CARS Tag Model Renter ---------- --------------- ----------------------------------------- 123-ABC Honda 124-xyz Your Honda Smith, Bob 12-3456 / GOLD CMD: RETURN, 123-ABC, 10, 400 Car 123-ABC is not rented CMD: RETURN, 124-xyz, 20, 300 Rental Return Receipt ------ ------ ------- R & W Car Rental hereby acknowledges that the car described below Your Honda, license plate tag 124-xyz has been returned to the company by the renter Smith, Bob (12-3456 / GOLD ) who agrees to pay the following charges Daily Charge: 480.00 Mileage Charge: 20.00 Insurance Charge: 30.00 Total Charge: 530.00 CMD: PRINT CARS Tag Model Renter ---------- --------------- ----------------------------------------- 123-ABC Honda 124-xyz Your Honda

Free Advice and Information

  1. Carefully consider your class design. In general, a minimal class interface is best. Consider how best to reuse code. Plan for the future reuse of code you write in this project.
  2. Functions called from main that are not part of any class are permitted. If you create new functions, their prototypes must be found in Proj2Aux.h and they must be implemented in Proj2Aux.cpp; you must modify the makefile provided to account for these new files.
  3. Your program must provide adequate error checking as described above.
  4. Think carefully about the proper use of const for parameters and member functions. Doing const correctly from the beginning can save lots of effort and frustration later.
  5. Review the class notes on the different methods of passing parameters. Each is best for a different situation.
  6. Be sure your function header comments list the pre- and post-conditions and handle each pre-condition that is not met.
  7. Your program will be tested with a variety of conditions.
  8. Use incremental development.
  9. Expect to use/modify code from this project in project 3. Design and code accordingly.
  10. This project is approximately 450 lines of code (many of which can be copied from proj 2), not including file header comments or function header comments.... don't procrastinate.

Project Design Assignment

Your project design document for project 2 must be named p2design.txt. Be sure to read the
design specification carefully. Submit your design in the usual way: submit cs202 Proj2 p2design.txt

Project Makefile

You must provide the makefile for this project. Use the makefile provided to you for project 1 and modify it appropriately. If you don't change the names of the files from project 1, the changes will be minimal.

The graders will be typing the command make Proj2 when they grade your project. This command must cause all .cpp files to be compiled and the executable named Proj2 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, Proj2, and backup files created by the editor. More information about these commands can be found at the bottom of the makefile.


Grading

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.

85% - Correctness

This list may not be comprehensive, but everything on this list will be verified by the graders.

15% - Coding Standards

Your code adheres to the CMSC 202 coding standards as discussed and reviewed in class.
In particular, since this is your first C++ program using classes, pay attention to the list below. Graders will check all applicable items in the coding standards.
  1. Your class implementation and class usage
  2. Proper use of const
  3. Your function header comments (particularly pre- and post-conditions)
  4. In-line comments
  5. Code readability

Project Submission

Submit all your files in the usual way. You must make sure that all files necessary to compile and link your project (using the makefile) are listed. You need not submit all files at the same time. You may resubmit your files as often as you like, but only the last submittal will be graded and will be used to determine if your project is late. For more information, see the projects page on the course website.

You can check to see what files you have submitted by typing

submitls cs202 Proj2

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.


Last Modified: Monday, 28-Feb-2005 07:08:10 EST