0% found this document useful (0 votes)
15 views3 pages

CS301 Assignment 2

Uploaded by

zohaibsan290
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views3 pages

CS301 Assignment 2

Uploaded by

zohaibsan290
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Assignment No.

02
Total Marks: 20
SEMESTER Fall 2025
Due Date: 24 Nov, 2025
CS301- Data Structures

Instructions
Please read the following instructions carefully before solving & submitting assignment:
It should be clear that your assignment will not get any credit (zero marks) if:
 The assignment is submitted after the due date.
 The submitted code does NOT compile.
 The submitted assignment is other than .CPP file.
 The submitted assignment does NOT open or file is corrupted.
 The assignment is copied (from other student or ditto copy from handouts or internet).
 The Queue is implemented using array and STL is used.

Uploading instructions
For clarity and simplicity, you are required to Upload/Submit only ONE .cpp “ Assignment 2 Template” file
after completing its code.

Note:
 Use ONLY Dev-C++ IDE.
 Mention your own student VU id instead of BC123456789 in “ Assignment 2 Template” file as given in the
output screenshot.
 Add the code where commented (// Write your code here) in given .cpp “ Assignment 2 Template” file for the
following functions.
 Only implement these functions enqueueVisitor(), dequeueVisitor(), displayVisitor(), removeByIdVisitor().

Learning Objectives:

 Apply queue concepts to a real-world simulation


 Master linked list operations in object-oriented design
 Learn multi-queue coordination logic

For any query about the assignment, contact at cs301@vu.edu.pk

GOOD LUCK
Problem Statement Marks 20
You are required to write a program to manage visitors entry process in a hospital. The hospital has two categories of
visitors: VIP Visitors and Normal Visitors.
Your task is to implement a Queue System using Linked Lists that automatically manages both queues and performs all
operations sequentially without any user interaction.
The system performs the following operations automatically, as outlined in the provided “Assignment 2 Template.cpp”
file:
1. Initialize and Display Visitor Queues:
• Create two queues:
- One for VIP Visitors
- One for Normal Visitors
• Automatically enqueue (add) at least 5 visitors with visitor IDs, names, and their category (VIP or Normal).

2. Serve Visitors (Dequeue Operation):


• Visitors are served automatically in order of their category:
- VIP visitors are served first, followed by Normal visitors.
• Display the serving visitors.

3. Remove a Specific Visitor (By ID):


• Automatically remove a visitor from either queue using their visitor ID (for example, ID 204).
• Display an appropriate message confirming whether the visitor was found and removed or not found in any queue.

4. Display Remaining Visitors:


• Count and display the total number of visitors remaining across both queues.

Your Task to Perform:

• Understand the Provided Code Template:


Open and study the provided “Assignment 2 Template.cpp” file uploaded on VULMS.
This file contains class definitions and function declarations to implement the visitor queue system using linked lists.
• Implement the Following Functions:
- enqueueVisitor() — Add a new visitor to the end of the queue.
- dequeueVisitor() — Serve and remove the visitor from the front of the queue.
- displayVisitor() — Display all visitors in the given queue.
- removeByIdVisitor() — Remove a visitor by ID from the queue.
• In the main() Function:
 Replace the Sample VUID with Your Own:
In the code and output messages, replace the example VUID “BC123456789” with your actual VUID to personalize and
validate your submission. Otherwise, your marks will be deducted.

 Automatically enqueue and serve visitors in both VIP and Normal queues (no user input required).
- Include output messages to clearly indicate each operation.
- The output should be well formatted and easy to understand for evaluation.

Sample Output Screenshot:

Lectures Covered: This assignment covers Lecture # 07 - 12.


Deadline: Your assignment must be uploaded/submitted on or before 24 November 2025.

You might also like