Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a full class definition for a class named ContestResult , and containing t

ID: 3645577 • Letter: W

Question

Write a full class definition for a class named ContestResult , and containing the following members:
A data member winner of type string , initialized to the empty string.
A data member secondPlace of type string , initialized to the empty string.
A data member thirdPlace of type string , initialized to the empty string.
A member function called setWinner that has one parameter, whose value it assigns to the data member winner .
A member function called setSecondPlace that has one parameter, whose value it assigns to the data member secondPlace .
A member function called setThirdPlace that has one parameter, whose value it assigns to the data member thirdPlace .
A member function called getWinner that has no parameters and that returns the value of the data member winner .
A member function called getSecondPlace that has no parameters and that returns the value of the data member secondPlace .
A member function called getThirdPlace that has no parameters and that returns the value of the data member thirdPlace .

Explanation / Answer

//please rate. right answer for codelab


class ContestResult{

private:

string winner;

string secondPlace;

string thirdPlace;

public:

void setWinner(string);

void setSecondPlace(string);

void setThirdPlace(string);

string getWinner() ;

string getSecondPlace() ;

string getThirdPlace() ;

};

void ContestResult::setWinner(string x){

winner=x;}


void ContestResult::setSecondPlace(string y){

secondPlace=y;}


void ContestResult::setThirdPlace(string z){

thirdPlace=z;}


string ContestResult::getWinner() {

return winner;}


string ContestResult::getSecondPlace() {

return secondPlace;}


string ContestResult::getThirdPlace() {

return thirdPlace;}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote