Assignment 2
Due 22 August 2025
Flowcharts (10 Marks)
1. A shop sells books, maps and magazines. Each item is identified by a unique 4 – digit
code. All books have a code starting with 1, all maps have a code starting with 2 and
all magazines have a code starting with 3. The code 9999 is used to end the algorithm.
Write an algorithm in the form of a flowchart which inputs the codes for all items in
stock and outputs the number of books, number of maps and the number of magazines
in stock. Include any validation checks needed.
UMLs (20 Marks)
2. A rapidly growing smart city is developing an integrated Smart Parking Management
System (SPMS) to optimize parking availability, reduce traffic congestion, and
enhance the user experience for drivers. The system aims to manage various types of
parking, including street parking zones and multi-story parking garages.
Key Requirements and Functionality
i.
ii.
iii.
iv.
v.
vi.
vii.
Each individual parking space (whether on the street or within a garage) must be
monitored in real-time for its occupancy status (Vacant, Occupied, Reserved,
Out-of-Service). This monitoring is done via embedded sensors.
Drivers must register an account with the SPMS, providing personal details. They
can register multiple vehicles, each with a unique license plate and vehicle type
(e.g., Sedan, SUV, EV).
Registered drivers should be able to search for available parking spaces based on
location, type (e.g., EV charging, disabled), and desired duration. They can then
reserve a specific space for a future time slot. Reservations have a start and end
time and can be cancelled.
Parking rates vary based on location (zone/garage), time of day, and demand. The
system should be able to apply different pricing models (e.g., per hour, flat daily
rate).
Drivers pay for parking sessions (both reserved and immediate occupancy)
through the system using various payment methods (e.g., credit card, mobile
wallet). The system needs to record transaction details.
If a vehicle overstays its paid duration or parks illegally (e.g., in a reserved spot
without a valid reservation), the system should detect this and allow authorized
personnel (e.g., parking enforcement officers) to issue a digital violation/fine.
The system should generate reports for administrators on occupancy rates,
revenue, and violation statistics.
Task:
a) Class Diagram (15 Marks)
Draw a UML Class Diagram for the Smart Parking Management System. Your diagram
should clearly identify at least 8-10 core classes from the scenario, all necessary
relationships between classes, correct multiplicities for all relationships, and ensure
your diagram is clear, well-organized, and adheres to standard UML notation.
b) Sequence Diagram (5 Marks)
Choose one of the following critical use cases and draw a UML Sequence Diagram for it
i.
ii.
Driver Reserves a Parking Space
System Detects and Processes an Overstay Violation