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
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started