3.1.5 Dimachaerus dimachaerus +dimachaerus ( +dimachaerus ) +taunt ) :atring +de
ID: 3741917 • Letter: 3
Question
3.1.5 Dimachaerus dimachaerus +dimachaerus ( +dimachaerus ) +taunt ) :atring +defenceBolster):void +apecialAction ) void +print):void The methods of the class are: dimachaerus: This constructor has a default profile to use when creating a D machaerus gladiator. The statistics that are the default values for the class are below: 1. HP: 16 2. AS: 0.75 3. DS: 0.15 4. appeal: 10 5. damage: 4 6. seedR: 100 print: This method will print out the statistics of the gladiator in a row by row fashion. For example: HP: 16 AS: 0.65 DS: 0.55 Appeal: 1 Damage: 4 SeedR 100 dimachaerus: This is the destructor for the class. It will print "Dimachaerus removed" without the quotation marks and with a new line at the end. taunt: This method will return a unique message. The message s "MARS WILL HAVE YOUR HEAD!", without quotations. defenceBolster: This bolster wl increase his DS by 0.01 and his AS by 0.01. How- ever it will decrease his appeal by1 specialAction: When activated, the Dimachaerus will drop his appeal by 1 to gain more 2 HPExplanation / Answer
Please find the code below.
CODE
===================
#include <iostream>
using namespace std;
class dimachaerus {
private:
double HP, AS, DS, appeal, damage, seedR;
public:
dimachaerus() {
HP = 10;
AS = 0.75;
DS = 0.15;
appeal = 10;
damage = 4;
seedR = 100;
}
~dimachaerus(){
cout << "Dimachaerus removed!!" << endl;
}
string taunt() {
return "MARS WILL HAVE YOUR HEAD";
}
void defenseBolster() {
DS += 0.01;
AS += 0.01;
appeal -= 1;
}
void specialAction() {
appeal -= 1;
HP += 2;
}
void print() {
cout << "1. HP: " << HP << endl;
cout << "2. AS: " << AS << endl;
cout << "3. DS: " << DS << endl;
cout << "4. appeal: " << appeal << endl;
cout << "5. damage: " << damage << endl;
cout << "6. seedR: " << seedR << endl;
AS = 0.75;
DS = 0.15;
appeal = 10;
damage = 4;
seedR = 100;
}
};
int main() {
dimachaerus d;
d.print();
cout << endl << endl;
d.defenseBolster();
d.specialAction();
d.print();
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.