Question: Below for each class you find a UML and description of the public interface. Implementing the public interface as described is mandatory.There's freedom on how
Below for each class you find a UML and description of the public interface. Implementing the public interface as described is mandatory.There's freedom on how to implement these classes.The private properties and private methods are under your control. For each object, it's mandatory to create a header file h implementation file cpp and a driver. Blank files are included. The header should have the class definition in it The implementation file should contain the implementations of the methods laid out in the header fine. And finally the Driver should testdemonstrate all the features of the class. Two test suites are included so that work can be checked. It's important to implement the drivers to test and demonstrate Classes functionality.
KnightTest.cpp:
#define CATCHCONFIGMAIN
#include Knighth
#include
#include
#include
TESTCASEShould be able to create a Knight"
Knight arthur KnightSir Arthur", ;
TESTCASEShould be able to get Knight's name"
Knight elara KnightLady Elara", ;
string name elara.getName;
REQUIRETHATLady Elara", Catch::Matchers::Equalsname;
TESTCASEShould be able to get the level"
Knight cedric new KnightSir Cedric", ;
int level cedricgetLevel;
REQUIRE level;
TESTCASEShould be able to get the Max hit points"
Knight gwendolyn KnightLady Gwendolyn", ;
int max gwendolyn.getMaxHitPoints;
CHECK max;
Knight arthur KnightSir Arthur", ;
max arthur.getMaxHitPoints;
CHECK max;
TESTCASEShould be able to get health as a percentage"
Knight gwendolyn KnightLady Gwendolyn", ;
double health gwendolyn.health;
CHECKTHAThealth Catch::Matchers::WithinAbs;
Knight arthur KnightSir Arthur", ;
health arthur.health;
CHECKTHAThealth Catch::Matchers::WithinAbs;
TESTCASEGaining Experience should cause the Knight to level up
Knight gwendolyn KnightLady Gwendolyn", ;
gwendolyn.gainExperience;
int level gwendolyn.getLevel;
CHECK level;
Knight arthur KnightSir Arthur", ;
arthur.gainExperience;
arthur.gainExperience;
level arthur.getLevel;
CHECK level;
TESTCASEAttack should return times the knight's level"
Knight cedric new KnightSir Cedric", ;
int damage cedricattack;
CHECK damage;
Knight elara KnightLady Elara", ;
damage elara.attack;
CHECK damage;
TESTCASEShould be able to heal a Knight"
Knight gwendolyn KnightLady Gwendolyn", ;
gwendolyn.heal;
double health gwendolyn.health;
CHECKTHAThealth Catch::Matchers::WithinAbs;
Knight arthur KnightSir Arthur", ;
arthur.heal;
health arthur.health;
CHECKTHAThealth Catch::Matchers::WithinAbs;
TESTCASEShould take damage when damaged"
Knight gwendolyn KnightLady Gwendolyn", ;
gwendolyn.damage;
double health gwendolyn.health;
CHECKTHAThealth Catch::Matchers::WithinAbs;
Knight arthur KnightSir Arthur", ;
arthur.damage;
health arthur.health;
CHECKTHAThealth Catch::Matchers::WithinAbs;
TESTCASEShould not be able to heal a Knight more than
Knight gwendolyn KnightLady Gwendolyn", ;
gwendolyn.heal;
double health gwendolyn.health;
CHECKTHAThealth Catch::Matchers::WithinAbs;
TESTCASEDead Knights should return health"
Knight arthur KnightSir Arthur", ;
arthur.damage;
int health arthur.health;
CHECKTHAThealth Catch::Matchers::WithinAbs;
TESTCASEShould not be able to heal a Knight that is dead"
Knight gwendolyn KnightLady Gwendolyn", ;
gwendolyn.damage;
gwendolyn.heal;
double health gwendolyn.health;
CHECKTHAThealth Catch::Matchers::WithinAbs;
TESTCASEShould be dead when health is
Knight cedric new KnightSir Cedric", ;
cedricdamage;
bool isDead cedricisDead;
CHECKisDead;
Knight elara KnightLady Elara", ;
elara.damage;
elara.damage;
isDead elara.isDead;
CHECKisDead;
TESTCASEKnights can not return from the dead"
Knight cedric new KnightSir Cedric", ;
cedricdamage;
cedricheal;
bool isDead cedricisDead;
CHECKisDead;
Knight elara KnightLady Elara", ;
elara.damage;
elara.damage;
elara.heal;
isDead elara.isDead;
CHECKisDead;
Knight.h:
#include
using namespace std;
#ifndef KNIGHTH
#define KNIGHTH
static const int DAMAGESCALAR ;
static const int EXPERIENCEPOINTS
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
