1. Parking Lot System

Description

Design a system to manage a parking lot that supports multiple vehicle types and parking spot sizes. Each vehicle type occupies a different space size, and the lot must track available and occupied spots.


Class Design

Class: Vehicle (Abstract)

Attribute Type Description
plateNumber std::string Unique vehicle ID
size VehicleSize Enum: SMALL, MEDIUM, LARGE

Methods:

Derived Classes:


Class: ParkingSpot

Attribute Type Description
size VehicleSize Max vehicle size it can hold
vehicle Vehicle* Pointer to current parked vehicle

Methods:


Class: ParkingLot

Attribute Type Description
spots std::vector<ParkingSpot> All parking spots in the lot

Methods:


Design Notes


2. Online Shopping Cart System

Description

Model an online shopping cart where customers add items, view totals, and choose payment methods.


Class Design

Class: Product

Attribute Type Description
id int Product identifier
name std::string Product name
price double Unit price

Methods:


Class: CartItem

Attribute Type Description
product Product Product in the cart
quantity int Quantity selected

Methods:


Class: ShoppingCart

Attribute Type Description
items std::vector<CartItem> List of cart items

Methods:


Abstract Class: PaymentProcessor

Method Return Description
virtual void pay(double amount) = 0 β€” Abstract payment interface

Derived Classes:

Each implements pay(double amount) differently.


Design Notes


3. Library Management System

Description

Manage books, members, and borrowing transactions in a small library.


Class Design

Class: Book

Attribute Type Description
id int Book ID
title std::string Title
author std::string Author name
isAvailable bool Availability flag

Methods:


Class: Member

Attribute Type Description
name std::string Member’s name
borrowedBooks std::vector<Book*> List of borrowed books

Methods:


Class: Library

Attribute Type Description
books std::vector<Book> Catalog of books

Methods:


Design Notes


4. Chat Application

Description

Design a chat room system where users can join rooms, send messages, and view chat history.


Class Design

Class: User

Attribute Type Description
username std::string User’s name
status std::string Online/Offline

Methods:


Class: Message

Attribute Type Description
sender User Sender of the message
content std::string Message text
timestamp std::time_t Time sent

Methods:


Class: ChatRoom

Attribute Type Description
roomName std::string Room identifier
users std::vector<User*> Active users
messages std::vector<Message> Chat log

Methods:


Design Notes


Youtube Mock Interview