[SOLVED] CPSC121-Lab7

20.99 $

Programming resource
Digital learning resource
Category:
✓ Practical programming resource
✓ Suitable for guided study and reference
✓ Tutor guidance available when needed

Description

5/5 - (4 votes)

The following program is going to revolve around creating and using the “Gladiator” class, which is included in your github repository. You must use that class definition in your project. In addition to writing a main function that uses the class correctly, you will also be responsible for defining 4 member functions of the gladiator class.

Write a program that performs the following:

  1. Tell the user that they are going to be hosting a fight! But first, we need to…
  2. Declare your gladiator objects. This will call the constructor, which is where you will assign stats and assign, or ask for, a name.
    1. Max Health should be 150, 200, or 250
    2. Evasion and Crit should be two separate random values chosen from 5, 10, or

15%

  1. Minimum Damage should be in the range 8-14, with Damage Range in the range 16-22
  1. Display the names and stats of both fighters to the user, and inform them that the fight will begin
  2. Your gladiators will alternatingly attack each other using the appropriate member functions (think about who is attacking, and who is taking *how much* damage)
    1. Each attack should display info about damage and/or remaining health
    2. This will continue until a gladiator loses all their health
  3. Inform the user who was victorious. Ask if the user wants to run another fight (return to step 2) or not (end program)

Min_damage_roll = min(8) + rand() % range(6+1)

—Maximum Damage = Minimum Damage + Damage Range

—Min 30, range 50 would result in damage between 30-80

—To roll for a 10% chance, due to the % (per “cent” ie century) we will be taking rand() % 100 and comparing it to the chance, 10. If the random number generated is lower than the chance, an 8 for example, that’s considered a success.

—End of Chapter 8 slides contain more help with random numbers. Use srand properly (ie once)

Points:

1.5 – Documentation, readability, format

1.5 – Filename and Header

2 – Output testing

  • – Proper program flow (conditions, loops, functions, etc)
  • – Proper use of classes

Header

//Author: (your name)

//CPSC 121 Lab 7

//<MM/DD/YY> (Current Date)

Filename

<Last Name><First Initial>lab7.cpp

For example, my assignment would be named MayElab7.cpp

Note: I only want one file for this lab’s submission

Resource details

Understand the Task Before You Use the Resource

Review the requirements, identify the programming concepts involved, study the implementation and test your understanding with your own examples and modifications.