Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Processing Fundamentals Design And Implementation

Authors: KROENKE DAVID M.

1st Edition

8120322258, 978-8120322257

More Books

Students also viewed these Databases questions

Question

Describe effectiveness of reading at night?

Answered: 1 week ago

Question

find all matrices A (a) A = 13 (b) A + A = 213

Answered: 1 week ago