UMBC CMSC 104 CSEE | 104 | current 104

CMSC104, Spring 2006

Programming Project 3

Parking Lot

Out: Saturday, April 22, 2006
Due: Thursday, May 4, 2006 before 11:59 p.m.


The Objective

This project is designed to give you practice working with functions. It will also give you more practice working with while loops and switch statements.

The Background

Bubba's Parking Lot has been in business for the past 10 years. Over the years, Bubba has changed his system for producing customer receipts many times. Currently, he simply uses a cash register and his employees must figure out each customer's time spent in the parking lot by hand. Ugh! Finally, Bubba has decided he wants to move to a computer-based software program for producing receipts. You have been chosen to implement the software. The design specifications are given below.

The Task

Your job is to write a program that will print receipts for customers parking in Bubba's Parking Lot. The receipt should include the time the customer entered the lot, the time he or she left the lot, the total amount of hours spent in the lot (rounded up to the nearest hour), and the total charge for parking. You should prompt the user to enter the type of vehicle. The vehicle types allowed to park in the lot are cars, buses and trucks. In an effort to encourage people to park for a short period of time, two different hourly rates are used for each type of vehicle. Below is a chart listing the rates for each vehicle:
Type    First Rate        Second Rate
        First 3 Hrs       After 3 Hrs

Car      $0.00/Hr         $1.50/Hr
Truck    $1.00/Hr         $2.30/Hr
Bus      $2.00/Hr         $3.70/Hr
The functions you will write, in addition to the main function, are: You must use the function prototypes as they are given and may not change them in any way. You may use additional functions if you wish.

More Details

Sample Output

linux3[1]% a.out

[Your greeting goes here.]

What is the type of vehicle?
Please enter 'C' for car, 'T' for truck or 'B' for bus: C

What is the hour the vehicle entered the lot?
Please enter a number between 0 and 23: 10

What is the minute the vehicle entered the lot?
Please enter a number between 0 and 59: 30

What is the hour the vehicle left the lot?
Please enter a number between 0 and 23: 16

What is the minute the vehicle left the lot?
Please enter a number between 0 and 59: 0

-----------------------------
 BUBBA'S PARKING LOT RECEIPT

Type of vehicle: Car

Time-in:            10 : 30
Time-out:           16 : 00
                  ---------
Rounded Hours             6
                  ---------
Total Charge           4.50

     Have a nice day!
-----------------------------

linux3[2]% a.out

[Your greeting goes here.]

What is the type of vehicle?
Please enter 'C' for car, 'T' for truck or 'B' for bus: t

What is the hour the vehicle entered the lot?
Please enter a number between 0 and 23: 8

What is the minute the vehicle entered the lot?
Please enter a number between 0 and 59: 15

What is the hour the vehicle left the lot?
Please enter a number between 0 and 23: 12

What is the minute the vehicle left the lot?
Please enter a number between 0 and 59: 30

-----------------------------
 BUBBA'S PARKING LOT RECEIPT

Type of vehicle: Truck

Time-in:            08 : 15
Time-out:           12 : 30
                  ---------
Rounded Hours             5
                  ---------
Total Charge           7.60

     Have a nice day!
-----------------------------

linux3[3]% a.out

[Your greeting goes here.]

What is the type of vehicle?
Please enter 'C' for Car, 'T' for truck or 'B' for bus: F
You must either enter 'C' for Car, 'T' for Truck or 'B' for Bus.
Please try again: f
You must either enter 'C' for Car, 'T' for Truck or 'B' for Bus.
Please try again: B

What is the hour the vehicle entered the lot?
Please enter a number between 0 and 23: 100
The number must be between 0 and 23.
Please enter another number: -3
The number must be between 0 and 23.
Please enter another number: 2

What is the minute the vehicle entered the lot?
Please enter a number between 0 and 59: 70
The number must be between 0 and 59.
Please enter another number: 6

What is the hour the vehicle left the lot?
Please enter a number between 0 and 23: 9

What is the minute the vehicle left the lot?
Please enter a number between 0 and 59: 0

-----------------------------
 BUBBA'S PARKING LOT RECEIPT

Type of vehicle: Bus

Time-in:            02 : 06
Time-out:           09 : 00
                  ---------
Rounded Hours             7
                  ---------
Total Charge          20.80

     Have a nice day!
-----------------------------


Submitting the Program

Here is a sample submission command. Note that the project name starts with uppercase 'P'.

submit cs104 Proj3 proj3.c

To verify that your project was submitted, you can execute the following command at the Unix prompt. It will show the file that you submitted in a format similar to the Unix 'ls' command.

submitls cs104 Proj3