Question: EXERCISE A For this first exercise, you should implement the constructor for the Chief class that extends Police. The parameters used in the Chief constructor

EXERCISE A

For this first exercise, you should implement the constructor for the Chief class that extends Police. The parameters used in the Chief constructor are: string name, int inches, int weight, int yearsInService.

For example:

test result
Chief* c = new Chief("Felipe", 60, 100, 20); cout << c->toString() << endl;
{Chief: Name=Felipe Height=60 Weight=100 Rank=Chief Years=20 }

#include "VillageQ1.cpp"

/* * EXERCISE A * * Implement the Chief Class constructor by calling its super class constructor * and passing the appropriate parameters. * HINT: You use the Police class as a guide. And remember a Chief is a rank */

Chief::Chief(string name, int height, int weight, int yearsInService) : Police(NULL, 0, 0, NULL) //Dummy super constructor { //Implement here! }

___________

class Police : public Player

{

private:

const int SALARY = 50000;

string rank;

public:

Police(string name, int height, int weight, string rank) : Player(name, height, weight)

{

this->rank = rank;

}

string getRank() { return rank; }

void setRank(string rank) { this->rank = rank; }

virtual int getSalary() { return SALARY; }

virtual string toString();

virtual bool canEnterEvent(string event);

virtual string greet();

virtual bool equals(Player *p);

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!