Spring 2025 - CS301 - 1
Spring 2025 - CS301 - 1
01
Total Marks: 20
SEMESTER Spring 2025
Due Date: May 05,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:
o The assignment is submitted after the due date.
o The submitted code does NOT compile.
o The submitted assignment is other than .CPP file.
o The submitted assignment does NOT open or file is corrupted.
o The assignment is copied (from other student or ditto copy from handouts or internet).
o If Queue is not implemented through linked list.
Uploading instructions
For clarity and simplicity, you are required to Upload/Submit only ONE .cpp file.
The submitted assignment must be in .cpp format.
Learning Objectives:
GOOD LUCK
Marks: 20
Problem Statement
XYZ Electronics is a retail store that deals in a variety of electronic gadgets such as smartphones, tablets, watches,
and accessories. As new stock arrives, it is added to the store’s backroom inventory in a First-In-First-Out (FIFO)
manner for easy tracking and retrieval during sales.
To manage the stock effectively, XYZ Electronics wants you to create a C++ program that mimics a queue-based
system using a linked list. This program will automatically add smartphones, tablets, and smart watches,
where the count of each product is determined by the last three digits of your Student ID.
Add 8 tablets
Add 9 smart watches
Your program must not require any user input and must follow a FIFO approach to manage inventory.
Your Task:
You are required to develop a program that:
Records each electronic product as it arrives.
1. Product Class
Main Function:
In main function declare a variable of string data type and assign it to your vu student id.
Find last three digits from your complete vu student id.
Declare a variable and assign serial number 1 to it and then generate unique product ids.
Declare Queue class object then add your respective data by calling its enqueue (int data, int pid) function
by providing serial number and product id.
Call the displayFront() and displayRear() functions to display the first and last element of the queue.
Call the dequeue() function two times and then display the front element.
Note: Your output should be according to the given sample output according to your own VUID.
The last four digits are: 6789, so, the first product ID will be= 6789
After that, each new product will have its product ID incremented by 1, such as:
And so on…
Now, from the last three digits of your Student id (for example 789):
7 number of smartphone should be added in the Queue with serial number 1 to 7 with unique product ids
8 number of tablets should be added in the Queue with serial number 8 to 15 with unique product ids
9 number of smart watches should be added in the Queue with serial number 16 to 24 with unique product ids
Sample Output: