Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Beginning C# 2005 Databases

Authors: Karli Watson

1st Edition

0470044063, 978-0470044063

More Books

Students also viewed these Databases questions

Question

Question What is a Roth 401(k) feature?

Answered: 1 week ago

Question

Question Can employees make contributions to a profit sharing plan?

Answered: 1 week ago