CS 301 Assignment 1 due date April 16, 2012.

Assignments ,Quiz, Solved GDB

Moderator: abdulsaboor

CS 301 Assignment 1 due date April 16, 2012.

Postby saad7675 » Sat Apr 14, 2012 4:49 pm

Assignment No. 01
SEMESTER Spring 2012
CS301- Data Structures
Total Marks: 20

Due Date: April 12, 2012
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 with Programming the Linked list Data Structure.


For any query about the assignment, contact at cs301@vu.edu.pk
GOOD LUCK
Marks: 20
We need to store a number of Cricket Players and their Scores in a list using Linked List Data Structure. The data of the players will comprise of their Names and Scores, which means each Node of the Linked List will contain Player Name, Player Score and Next Pointer as follows,

You need to write a C++ Program which contains the following two classes and main function.

1. Player Class (means Node Class): This class should define three private variables for Player Name, Player Score and Next pointer, this class should also define Constructor, Getter and Setter functions for these variable as inline functions (means define these functions within class body).
2. PlayerList Class (means Linked List Class): This Class should define private variables for Header, CurrentPlayer ( means Head pointer, CurrentNode Node) and an int variable which count the number of Players in the Linked List.
The Class should also declare the following methods/Functions,
Constructor(): Default Constructor of the Class.
Add_NewPlayer(): This method should add new player only at the end of list.
Display(): This method should Print the Players information (Names and Score) in the list.
ListLength(): This method should return the total number of Players added in the list.
getTotalScore(): This method should return (print) Total score (e.g score of player1+player2.. etc).

Main Function(): In the main function define an object of the PlayerList class and call the Add_NewPlayer method with this object multiple times (At least two times), then call the Display(), getTotalScore and ListLength functions with this object, your output should look like this.



Lectures Covered: This assignment covers Lecture # 1-5
Deadline: Your assignment must be uploaded/submitted at or before April 12, 2012.
saad7675
Visitor
Visitor
 
Posts: 11
Joined: Thu Jan 26, 2012 8:24 am

Re: CS 301 Assignment 1 due date April 16, 2012.

Postby abdulsaboor » Sat Apr 14, 2012 5:59 pm

will update before due date
DR ABDUL SABOOR
PHD Scholar at Superior University Lahore- Pakistan
MS Business Administration (HRM)
BS Business Administration (Marketing)
Member Editorial Board Science Publishing Group USA
Member Editorial Board International Journal of Marketing Studies
Cell=0308-6837987

Pakistan
User avatar
abdulsaboor
ADMIN
ADMIN
 
Posts: 2004
Joined: Fri Sep 28, 2007 3:42 am
Location: vehari-punjab-pakistan

Re: CS 301 Assignment 1 due date April 16, 2012.

Postby sameea » Sun Apr 15, 2012 6:20 pm

plz 16 tk agr is a sloution send kar de sir
sameea
Visitor
Visitor
 
Posts: 30
Joined: Tue Oct 25, 2011 10:47 am

Re: CS 301 Assignment 1 due date April 16, 2012.

Postby abdulsaboor » Fri Apr 20, 2012 5:16 pm

#include<iostream.h>
#include<string.h>

using namespace std;

class Player{
public:
string PlayerName;
int PlayerScore;
Player *Next;

Player(string name, int scor)
{
this->PlayerName = name;
this->PlayerScore = scor;
this->Next=NULL;
}

};
Player *Sirr;
int Players;

void NewPlayer(string name, int score)
{
Player * current;
if(Sirr==NULL)
{
Sirr=new Player(name, score);
++Players;
}
else
{
current=Sirr;
while(current->Next!=NULL)
{
current= current->Next;
}
current->Next = new Player(name,score);
++Players;
}
}





void ShowAllPlayers()
{
Player * current;
current=Sirr;
while(current !=NULL)
{
cout<< current->PlayerName <<"\t\t\t";
cout<< current->PlayerScore<<endl;
current= current->Next;
}

}

main(){

NewPlayer("Ahmed",15);
NewPlayer("sayeed",15);
ShowAllPlayers();

system("pause");
}
DR ABDUL SABOOR
PHD Scholar at Superior University Lahore- Pakistan
MS Business Administration (HRM)
BS Business Administration (Marketing)
Member Editorial Board Science Publishing Group USA
Member Editorial Board International Journal of Marketing Studies
Cell=0308-6837987

Pakistan
User avatar
abdulsaboor
ADMIN
ADMIN
 
Posts: 2004
Joined: Fri Sep 28, 2007 3:42 am
Location: vehari-punjab-pakistan


Return to VU STUDENTS FORUM

Who is online

Users browsing this forum: No registered users and 4 guests
cron