Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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

Students also viewed these Databases questions

Question

=+2. Who are your colleagues?

Answered: 1 week ago

Question

What is Centrifugation?

Answered: 1 week ago

Question

To find integral of ?a 2 - x 2

Answered: 1 week ago

Question

To find integral of e 3x sin4x

Answered: 1 week ago

Question

To find the integral of 3x/(x - 1)(x - 2)(x - 3)

Answered: 1 week ago

Question

What are Fatty acids?

Answered: 1 week ago