CC-112 Programming Fundamentals SPRING 2023
Assignment 01
Vehicle Parking Fare Tracking System
Objectives:
To design software that can calculate parking fare for customers who park their cars in a
parking lot.
Prerequisite Skills:
Basic knowledge of mathematical calculations
Understanding of C’s basic constructs (formatted I/O, expressions, operators, if control
structure)
Overview:
This system will calculate parking fare for customers who park their cars in a parking lot when
following information is given:
a. A character showing the type of vehicle: ‘C’ for car, ‘B’ for bus, ‘T’ for truck.
b. An integer between 0 and 24 showing the hour the vehicle entered the lot.
c. An integer between 0 and 60 showing the minute the vehicle entered the lot.
d. An integer between 0 and 24 showing the hour the vehicle left the lot.
e. An integer between 0 and 60 showing the minute the vehicle left the lot.
This is a public lot. To encourage people to park for a short period of time, the management uses
two different rates for each type of vehicle, as shown in table below.
Type First Rate Second Rate
Car $0.00/hour first 3 hours $1.50/hour after first 3 hour
Truck $1.00/hour first 2 hours $2.30/hour after first 2 hour
Bus $2.00/hour first 1 hour $3.70/hour after first 1 hour
No vehicle is allowed to stay in the parking lot later than midnight; any vehicle that remains past
midnight will be towed away.
The input data consist of a character (type of vehicle) and a set of four integers representing the
entering and leaving hours. But these pieces of data must be input into the computer in a user-
friendly way. In other words, the computer must prompt the user to enter each piece of data (as
shown on top of the next page).
Note: Since there are no fractional charges, the program must also round the parking time up to
the next hour before calculating the charges.
Input / Output Format:
Assignment 01 Page 1 of 2
CC-112 Programming Fundamentals SPRING 2023
PARKING INFORMATION (Input Format)
Type of Vehicle? C (for Car)
Hour’s vehicle entered the lot (0 - 24)? 14
Minutes vehicle entered the lot (0 - 60)? 23
Hour’s vehicle left the lot (0 - 24)? 18
Minutes vehicle left the lot (0 - 60)? 8
PARKING LOT CHARGES (Output Format)
TYPE OF VEHICLE: CAR
TIME-IN: XX:XX
TIME-OUT: XX:XX
PARKING TIME: XX:XX
ROUNDED TOTAL: $X.XX
Sample Input/Output:
Input Output
C TYPE OF VEHICLE: CAR
14 TIME-IN: 14:23
23 TIME-OUT: 16:12
16 PARKING TIME: 02:11
12 ROUNDED TOTAL: $0.00
T TYPE OF VEHICLE: TRUCK
14 TIME-IN: 14:23
23 TIME-OUT: 16:12
16 PARKING TIME: 02:11
12 ROUNDED TOTAL: $2.00
B TYPE OF VEHICLE: BUS
14 TIME-IN: 14:23
23 TIME-OUT: 16:12
16 PARKING TIME: 02:11
12 ROUNDED TOTAL: $5.70
Supported Data Types:
Integer (long)
Float
Boolean (contains TRUE and FALSE)
File(s) to be submitted: Parking.c
Deadline: September 18, 2023. (11:59 pm)
Assignment 01 Page 2 of 2