Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Project 1
- Objective:
- The purpose of this lab project is to expose you to selection, loops and enforce the use of functions.
- Problem Specification:
- Passaic County Parking Authority needs a C++ program to compute and print for customers, who park in their parking lot, a statement detailing the parking fare when the following information is given:
- a. A character showing the type of vehicle:
- ‘C’, ‘c’ for car
- ‘V’, ‘v’ for Van
- ‘S’, ‘s’ for SUV
- ‘B’, ‘b’ for bus
- ‘T’, ‘t’ for truck
- b. An integer between 6 – 23 showing the hour the vehicle entered the lot.
- c. An integer between 0 – 59 showing the minutes the vehicle entered the lot.
- d. An integer between 6 – 23 showing the hour the vehicle left the lot.
- e. An integer between 0 – 59 showing the minutes the vehicle left the lot.
- This is a public lot. To encourage people to park for short period of time, the county uses two different rates for each type of vehicle, as shown in the table below.
- Type
- First Rate
- Second Rate
- Car
- $0.00/hr. first 3 hours
- $1.50/hr. after the first 3 hours
- Bus
- $1.00/hr. first 2 hours
- $2.50/hr. after the first 2 hours
- Truck
- $2.00/hr. first hour
- $3.50/hr. after the first hour
- Input data consists of a vehicle type and 4 integers representing entering and leaving hours and minutes. In a user friendly way (using prompts). Write a program to read the data from the keyboard, compute the customer’s bill, and print an appropriate statement.
- Typical data entered
- B, 14, 23, 18, 8
- Where B indicates Bus,
- 14 represent 2:00 PM
- 23 represent 23 minutes after 2:00
- 18 represent 6:00PM and
- 8 represent 8 minutes after 6:00.
- Requirements:
- Lot is open from 6:00AM to midnight.
- No vehicle is allowed to stay in the parking lot later than midnight and will be towed away.
- Charges are in increments of hours, if parked 2 hours and 1 minute, its 3 hours.
- Cars, Vans and SUV’s are treated as Cars
- Trucks are two classes (‘S’ or ‘s’ for small, uses Bus Rate and ‘L’ or ‘l’ for large uses Truck Rate.
- Comment thoroughly. Include: your name, course #, date, program name and a brief explanation of what does the program does.
- Follow good structured programming practices,
- Should do the hierarchical chart first
- Should do a flowchart/algorithm next
- Define constants as you see fit. If you have to, define the constants locally.
- Pass by value and by reference as needed
- Use at least 3 functions to represent input, process and output.
- Each function must have specifications.
- Output the result as shown below.
- Additional requirements
- A prompt controlled loop to allow us to enter new data set or leave the program.
- Validate the data such that only valid vehicles are allowed to enter the lot including small trucks and large trucks.
- Validate the data such that the Time-in is less than the time-out.
- Output for the program for each data set is as follows.
- Passaic County Parking Authority
- Parking Lot Charges
- Type of Vehicle: Bus
- Time–In 2:23 PM
- Time–Out 6:08 PM
- ____________
- Parking-Time 3 Hrs:45mins
- Rounded Parking Time 4 hours
- ____________
- TOTAL DUE $6.00 // Makes no sense; 4 => 2 + 2 => 2*1 + 2*2.5 = 7
- Thank you for using Passaic County Parking Authority
- Do you have another vehicle? (Y/N)
- Grading criteria:
- 5 points Good programming practices: Proper spacing, comments, use of variables, indentation and appearance of program.
- 5 points constants are used.
- 10 points Flowchart or algorithm for the function main only is handed-in and is correct.
- 5 points Hierarchical chart is handed-in and is correct.
- 5 points Proper heading and footing is printed.
- 5 points output is aligned and looks good.
- 15 points functions are properly used; parameters are properly passed.
- 5 points calculations are used correctly and the correct results are printed.
- 10 points a prompt loop is used to enter another vehicle’s data.
- 10 points all data entered is validated and messages are printed for incorrect data.
- 20 points Program runs correctly and produces the intended results.
- 5 points program runs and tests all given data below.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement