Question: Create a class Player using the following UML class diagram: Player -score: int = 0 -health: int = 100 +Player() +getPlayerScore() : int +getPlayerHealth() :

Create a class Player using the following UML class diagram:

Player

-score: int = 0

-health: int = 100

+Player()

+getPlayerScore() : int

+getPlayerHealth() : int

+setPlayerScore(in score : int) : void

+setPlayerHealth(in health : int ) : void

+play(): void

Code C++ with header.h file, fuction.ccp file and main.cpp file with the following condition:

Player collected 10 bonus objects and each bonus object increase the player score, uses counter-controlled repetition to solve the bonus calculation.

Add a new function called CalculateBonusAndAverage () to calculate and display the collective bonus points.

Display the total score after adding the bonus points and calculate the average bonus points and display the results.

Implement the sentinel controlled repetition for player bonus score.

Implement the nested control statements, the program should keep picking random enum and calculate the player score until the health of the player become 0 or the player dies.

The example output should be:

Initial Health is 100

Initial Score is 0 points

The Player has been attacked and the total health is 95

Total score is 10 points

********Code C++ and need to be in 3 files: Player.h, Player.ccp, and Main.cpp **********

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!