Assignment #3
How to submit your work
Submission Date: Upload to UR Courses before the electronic cutoff time 11:59 pm on 15 June
2025:
1. Your C++ source program, named assign3 username.cpp. At the top of your source
file, include a structured header comment that includes:
(a) Program name and date
(b) Problem statement – a brief description of what the program does
(c) Input and output descriptions
(d) Step-by-step main algorithm in English – describing the logic of the program
(e) List of major functions and their purpose
This header should come before your actual C++ code, and be written entirely in com-
ments (//). It should provide enough information that someone reading it can understand
what the program is supposed to do without reading the code.
2. The output file, named tickets username.txt, generated by executing your program for
at least five customers.
Notice: You must use only techniques taught in CS110. Late assignments will not be
accepted.
Problem Statement (Parking Lot Billing System)
1. (100 marks) You are tasked with writing a C++ program to simulate a billing system for
a parking garage. The garage charges vehicles based on the number of hours they are parked,
using the following rate policy:
• First hour: $5
• Each additional hour: $3/hour
• Maximum charge per 24-hour period: $50
• Minimum charge: $5 (even for less than one hour)
Your program should:
1. Allow input for multiple customers.
2. For each customer, prompt for:
1
Parking Lot Billing System C++ Assignment
• License plate number as a string without whitespace including three capitals and
three digits, for instance XYZ789
• Entry hour as an integer between 0 and 23
• Exit hour as an integer between 0 and 24. It must be greater than entry
• If entry hour or exit hour is not in the range mentioned above, print something like
“Invalid input. Please try again”.
3. Calculate total hours parked.
4. Apply the billing policy to compute the charge.
5. Print a receipt with license plate, hours parked, and total charge.
6. Save the ticket to a file named tickets.txt.
7. Ask whether to process another customer (y/n). If a customer enters y or Y, the process
continues.
Functional Requirements
You must use at least the following five functions using their prototypes.
• int getParkingDuration(int entry, int exit);
• double calculateCharge(int hours);
• void printReceipt(string plate, int hours, double charge);
• bool askContinue();
• void writeToFile(string plate, int hours, double charge);
Sample Output on Console
Enter license plate: XYZ789
Enter entry hour (0-23): 9
Enter exit hour (1-24): 14
-----------------------------------
License Plate: XYZ789
Hours Parked : 5
Total Charge : $17
-----------------------------------
Ticket written to file.
Process another customer? (y/n): y
Sample Output on the file tickets.txt
License Plate: XYZ789
Hours Parked : 5
Total Charge : $17
-----------------------------
Page 2