Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 6

Assignment No.

01
Total Marks: 20
SEMESTER Spring 2019
CS301- Data Structures Due Date: 14/05/19
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 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).
Uploading instructions
For clarity and simplicity, You are required to Upload/Submit only ONE .CPP file.

Note: Use ONLY Dev-C++ IDE.


Objective
The objective of this assignment is

o To make you familiar of Programming with List Data Structure.

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

GOOD LUCK
Marks: 20
Problem Statement:

You have to implement a List Data Structure of student profile information records by using Array in C++
language. In which you have to create:

1. A structure (using struct keyword) named StudentProfie.


2. A class named ArrayList.

Details:
StudentProfile structure must have five variables of type string (string.h library) in it.
1. userid
2. userName
3. subject
4. degreeProgram
5. uniName

ArrayList should implement following data members and member functions:

Data Members Description


array[] Declare an array of type StudentProfile.
current Declare an integer variable used to store array index value we are
currently working with.
listSize Declare an integer variable to store the size of the list.

Methods Description
add(X,?) Add student profile record in the array list at position in which we want
to add it like 0,1,2,3,4,5… in the list.
e.g. arrList.add(studentProfile1,5) while arrList is an object of
ArrayList class and position is 5.
find(X) Find particular student profile in the array list.
e.g. arrList.find(testStdProfile).
update(X,?) Update student profile record at a given position in the array list.
e.g. arrList.update(stdProfile1,2).
remove (?) Remove student profile record from the given position in the array list.
e.g. arrList.remove(1).
listLength() Return size of list. (Not array size)
e.g. arrList.listLength().
showList() Will show the list data as given in below screenshots (Detailed Output
Screenshot).
e.g. arrList.showList().
cmpStdRec() Will compare two student profiles if they are same or not.
e.g. comStdRec(stdProfile1,stdProfile2).

(“X” denote StudentProfie Object means a student profile record while “?” denotes position where want to add a
particular record in the array list.)
In the main() function you have to:

1. Create five object of type StudentProfie at first five positions and then add all of them in the array list by
using add(X,?) method of ArrayList.
2. Then you have to find 4th student profile using find(X) method.
3. Update 4th student profile using update(X,?) method and set it same as 1st student profile record.
4. Remove 4th student profile using remove(X) method.
5. At last show the length of array list using listLength() method.
6. For first four steps you have to call showList() method to show list data after calling each function like
given in the below screenshots.

Note: First student profile record should be your own data.


For Example:
If your id is BC123456789, name as Bilal, Subject CS301, Degree BSCS and University VU. Then this student
profile record must store at first position in the list like given in the screenshot.

Detailed Output Screenshot:


Main Output Screenshot:
Lectures Covered: This assignment covers Lecture # 1-5.
Deadline: Your assignment must be uploaded/submitted at or before, May 14, 2019.

You might also like