BZU PAGES: Find Presentations, Reports, Student's Assignments and Daily Discussion; Bahauddin Zakariya University Multan

BZU PAGES: Find Presentations, Reports, Student's Assignments and Daily Discussion; Bahauddin Zakariya University Multan (http://bzupages.com/)
-   MSCS Semester- II (http://bzupages.com/173-mscs-semester-ii/)
-   -   assignment of data structure (http://bzupages.com/f173/assignment-data-structure-23527/)

aleeza khan 19-04-2012 11:08 AM

assignment of data structure
 
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.

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.
  • 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).
  • 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.





All times are GMT +5. The time now is 10:18 PM.

Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.