Question
CIS2542 Homework 02 (C++) Gorg vs Boov Battle Part 1 Meet the Boov The Gorg can no longer be reasoned with! Negotiations cannot go well
CIS2542 Homework 02 (C++) Gorg vs Boov Battle Part 1 Meet the Boov
The Gorg can no longer be reasoned with! Negotiations cannot go well if you have no idea what the other side wants! They are so strong and vicious that ignoring them only means Earth is indirectly conquered somehow? Its not my movie plot, but my retelling is totally butchering it for sure.
The Boov are friends of all peoples across the galaxy. Or so we are told. These beloved creatures want nothing more than peace and harmony, as long as it is their version of peace and harmony. It turns out okay for everyone in the end I suppose.
Maybe you can tell from the descriptions, but the Boov are quite the underdogs here! Captain Smek will need to simulate a Gorg battle many times over to see what their odds of victory would be.
For the first part of this simulation, lets create the Boov class. Here are their specifications.
Boov
- Every one of them can have a different name. There is no default name for a Boov.
- Every individual Boov starts with a health point value in the range [10-15] randomly selected
- When a Boov gets attacked:
- 1/4 of the time randomly, the attack does no damage
- 1/4 of the time randomly, the attack does 1 damage
- 1/2 of the time randomly, the attack will hit them and do [2-5] random damage
Requirements
1) Create a Boov class type
- Private string member variable for name
- Private int member variable for health
- Public constructor which initializes both member variables
- Public get function for the name
- Public get function for the health value
- Public boolean function called IsDefeated()
- A Boov is defeated when health <= 0
- Public void function called Print() to print out the valuable object details
- Public void function called GetsAttacked()
- The above section describes the results of when a Boov gets attacked
- Anything missing? Let me know if there is
2) Create a main() function which creates a Boov object using this class
- Create a Boov object (We will be sending one named OhNo off to do all the battling)
- Test every one of your functions thoroughly
- Create a loop that uses the GetsAttacked() function until the Boov is defeated
- How many times on average can the Boov take damage before it is defeated?
- Create a loop (say 100000 simulations) and find out!
- Poor OhNo!
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