CS301 Assignment No 2 Solution Fall 2019 | Virtual Study Solutions

Adsetra Ads

 

CS301 Assignment No 2 Fall 2019

Dear Students, Here you can read or download CS301 - Data Structures Assignment No 1 Solution of Semester Fall 2019. CS301 Assignment Due Date is 29 November 2019. Total Marks are 20. The Solution File + Sample Preview have been added. Previously we shared CS610 Assignment No 2 Solution Fall 2019.

Data Structures-CS301-Assignment-no-2-solution-fall-2019
Data Structures-CS301-Assignment-no-2-solution-fall-2019

Please Note:
We are here to facilitate your learning and we do not appreciate the idea of copying or replicating solutions. 

CS301 Assignment 2 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 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).

CS301 Uploading instructions

For clarity and simplicity, You are required to Upload/Submit only ONE .CPP file

Please Note: Use ONLY Dev-C++ IDE.

CS301 Assignment Objective

The objective of this assignment is
  • To make you familiar of Programming with Queue Data Structure.

CS301 Assignment 2 Problem Statement:


You have to implement a Queue Data Structure for student’s admission applications in the university by using Array in C++ language. In which you have to create:

  1. A structure (using struct keyword) named Student.
  2. A class named ArrQueue.
Details:
Student structure must have two variables of type string (using string.h library) in it.
  1. userVUID
  2. userDetail
Structure Variables
Description
userVUID
It will store the student id e.g.
BC12345688
userDetail
It will store user details as Name (Degree Program) e.g.
Bilal (BSCS)



ArrQueue should implement following data members and member functions:


Data Members
Description
arr[arrLength]
arr” is an array of type Student which will store queue students information in the array. While “arrLength” is the length of the array which is 5.
front
front variable will store the value of array index of first user in the queue.
rear
rear variable will store the value of array index of last user in the queue.

Methods
Description
enQue(X)
Place X after the rear of the queue (If array have empty space).
e.g. queue.enQue(X).
You have to handle these cases for enQue().
1.    If queue is empty. Then add Student to Queue.
2.    If queue is full. Then show message:
“Queue is full”.
deQue()
Remove the student from front position in the queue and move all students forward in the queue. (If array is not empty).
e.g. queue.deQue().
You have to handle these cases for deQue().
1.    If queue is empty. Then show message at “Que is empty cannot remove students”.
2.    If queue is not empty, remove element from the queue.
Note: Removal of Students from Queue will be according to First In First Out (FiFO) Method (Means a student who comes to queue first will remove from the queue first then others).
queLength()
Return size of Queue. (Not array size)
e.g. queue.queLength().
isEmpty()
Return TRUE if Queue is empty, FALSE otherwise.
isFull()

Return TRUE if Queue is full, FALSE otherwise.
showQue()
Will show the Queue data as given in below screenshots (Detailed Output Screenshot).
e.g. queue.showQue().

(“X” denote “Student” structure Object means a student profile record while “queue” denotes and Object of the class “ArrQueue”.)

In the main() function you have to:
  1. Create an array of objects having size 5 and of type “Student” and store five student’s data in it.
  2. Make a queue and add all students in it by using for loop with enQue() method. Then show the array using showQue() method like given in “Main Output Screenshot”.
  3. Then you have to remove students from the queue according the following conditions e.g. Your id is “BC12345687” then last digit is 7.

  • If last digit is Even Number then remove first two students from the queue using for loop with deQue() method. There will be 3 remaining students in the queue out of 5 as we have removed two students.
For details see screenshots under “Main Output Screenshot” heading.
  • If last digit is an Odd Number (e.g. in above id 7 is an odd number) then remove first one student form the queue using for loop with deQue() method. There will be 4 remaining students in the queue out of 5 as we have removed three students.
For details see screenshots under “Main Output Screenshot” heading.
  1. After that show queue data using showQueue() method as given in “Main Output Screenshot”.
  2. Last student data should be your own data and all above ids must be one less than your id number according to Detailed Output Screenshot.

CS301 Assignment 2 Solution Fall 2019

You can see the Sample Preview of CS301 Assignment 2 Solution provided by (Virtual Study Solutions) below. Click on Download Button to Download Solution File in Your PC. Please Share it with your friends. You can also like our Facebook Page or Subscribe Us on YouTube for Latest Updates related to Assignment Solution and Past Papers.


We also recommend you to read:

CS301 Past Papers Collection

Download  [ CS301 Mid Term Papers Solved by Moaaz ]   

CS301 Assignment 2 Solution Sample Preview

CS301 Solution File Sample Page Preview has been added below.

CS301 Assignment 2 Solution Sample Preview Fall 2019
CS301 Assignment 2 Solution Sample Preview Fall 2019

CS301 Solution Output Preview Via Online Compiler
= cpp.sh/3rofi

Download CS301 Assignment No 2 Solution Fall 2019

File NameDownload Link
 CS301 Assignment No 1 Solution Fall 2019.cpp Download
Please Share your valuable feedback in comments section. Thank You.

Post a Comment

  1. please upload video and assignment file kal last date hai

    ReplyDelete

 

Top