Question: write a c++ program. Define your class in a header file and implement in a .cpp file also include a main file. gladiator.h #ifndef GLADIATOR_H

write a c++ program. Define your class in a header file and implement in a .cpp file also include a main file.

write a c++ program. Define your class in a header file and

implement in a .cpp file also include a main file. gladiator.h #ifndef

gladiator.h

#ifndef GLADIATOR_H #define GLADIATOR_H #include #include using namespace std;

class gladiator { public: //constructor and destructor gladiator(); virtual ~gladiator();

//generate random number by using seedR property void setRandomSeed();

//getters for gladiator properties int getSeedR() const; int getHP() const; double getAS() const; double getDS() const; int getAppeal() const; int getDamage() const;

//setters for gladiator properties void setSeedR(int s); void setHP(int s); void setAS(double s); void setDS(double s); void setAppeal(int s); void setDamage(int s);

//function to attack other gladiator int attack(gladiator & glad);

//virtual functions implemented by child classes virtual string taunt() = 0; virtual void print() = 0; virtual void defenceBolster() = 0; virtual void specialAction() = 0;

private: int HP; //gladiator's health double AS; //Attack skill probability of attack 0-1 by them double DS; // Defense skill probability attack to them 0-1 int appeal; //represent charisma and crowd applause int damage; //physical damage capacity int seedR; // value used when generating randoms seed };

#endif

---------------------------------------------------------------------------------------------------------------------------------------------------------------------

gladiator.cpp

#include "gladiator.h" #include #include #include #include #include using namespace std;

//constructor implementation gladiator::gladiator() {

}

//destructor gladiator::~gladiator() { }

//generating random seed value void gladiator::setRandomSeed() { srand(seedR); }

//getter for seedR int gladiator::getSeedR() const { return seedR; }

//getter for HP int gladiator::getHP() const { return HP; }

//getter for AS double gladiator::getAS() const { return AS; }

//getter for DS double gladiator::getDS() const { return DS; }

//getter for Appeal int gladiator::getAppeal() const { return appeal; }

//getter for Damage int gladiator::getDamage() const { return damage; }

//setter for SeedR void gladiator::setSeedR(int s) { seedR = s; }

//setter for HP void gladiator::setHP(int s) { HP = s; }

//setter for As void gladiator::setAS(double s) { AS = s; }

//setter for Ds void gladiator::setDS(double s) { DS = s; }

//setter for appeal void gladiator::setAppeal(int s) { appeal = s; }

//setter for damage void gladiator::setDamage(int s) { damage = s; }

//implementation of attack int gladiator::attack(gladiator& glad) { int renown = 0; double random = 0 + (1-0)*rand()/((double) RAND_MAX); if(random

string gladiator::taunt() {

}

void gladiator::print() {

}

void gladiator::defenceBolster() {

}

void gladiator::specialAction() {

}

-----------------------------------------------------------------------------------------------------------------------------------------------

trax.h

#ifndef TRAX_H #define TRAX_H #include "gladiator.h" #include #include using namespace std;

class trax:public gladiator { int sprints; public: int getSprints(); void setSprints(int a); trax(); ~trax(); void print(); string taunt(); void defenceBolster(); void specialAction(); };

#endif

-----------------------------------------------------------------------------------------------------------------------------------

murmillo.h

#ifndef MURMILLO_H #define MURMILLO_H #include "gladiator.h" #include #include using namespace std;

class murmillo:public gladiator { public: murmillo(); ~murmillo(); string taunt(); void print(); void defenceBolster(); void specialAction(); };

#endif

------------------------------------------------------------------------------------------------------------------------------------------

retiarus.h

#ifndef RETIARIUS_H #define RETIARIUS_H #include "gladiator.h" #include #include using namespace std;

class retiarius:public gladiator { private: int control; public: retiarius(); ~retiarius(); int getControl(); void setControl(int); string taunt(); void defenceBolster(); void specialAction(); void print(); };

#endif

----------------------------------------------------------------------------------------------------------------------------------

dimachaerus.h

#ifndef DIMACHAERUS_H #define DIMACHAERUS_H #include "gladiator.h" #include #include using namespace std;

class dimachaerus:public gladiator { public: dimachaerus(); ~dimachaerus(); string taunt(); void defenceBolster(); void specialAction(); void print(); };

#endif

The team class encapsulates and holds the individual gladiator objects as a collective fighting team. Here is where a number of the operator overloads will be implemented so that creating and managing gladiator teams is an easy process. team -fightingTeam: gladiator -teamSize:int +team ) +team C) +getSize ):int +aetSize(a:int) :void toperatorll (i:int) : gladiator & toperator+(add:int *):team & toperator-(sub:int *):team & +operator):team +friend operator

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!