Question: Create a Player class that contains the following members: - A private data member to store a player name - A private data member to

 Create a Player class that contains the following members: - A

Create a Player class that contains the following members: - A private data member to store a player name - A private data member to store the number of games played - A private data member to store an integer pointer that will point to a dynamic array that will store games' scores A private data member to store the highest score A private non-inline member function that computes the highest score of all randomly generated scores. Please note that the definition of this function is placed outside the class, while its prototype is inside the class. A public non-inline constructor function that obtains a player name and the number of games played from the user. This function also uses random numbers generator to generate scores randomly and store these random scores into the array that is the data member of the class, i.e. contained within the every object of the Player class. Random scores should be in the range from 0 to 100. This function will call the function that computes the highest score as well. A public member function that displays the player's name and his/her highest score. - A public destructor function to delete the dynamic array that stores scores. Design the main() function that prompts the user to choose a number of players. A dynamic array of Player objects will be created and the size of this array is equal to the number of players. The program will call class member functions, including constructor function that will be automatically called, to obtain the player name, generate scores randomly and compute and display the highest scores respectively. Please note that the error checking and handling for a memory allocation error is required. A sample output of this program could be as follows: Number of players => 3 Enter player name #1 and number of games => Joe 5 Enter player name #2 and number of games => Mike 9 Enter player name #3 and number of games => Yo 7 Highest scores: Joe = 83 Mike = 91 Yo = 88

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!