Question

Write a full class definition for a class named ContestResult , and containing the following members:...

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 .

0 0
Add a comment Improve this question Transcribed image text
Answer #1
class ContestResult{
private:
string winner;
string secondPlace;
string thirdPlace;
public:
string setWinner(string);
string setSecondPlace(string);
string setThirdPlace(string);
string getWinner(string);
string getSecondPlace(string);
string getThirdPlace(string);
};
Add a comment
Answer #2

//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;}


Add a comment
Answer #3

correct codelab A:


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;}


Add a comment
Know the answer?
Add Answer to:
Write a full class definition for a class named ContestResult , and containing the following members:...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • C++ Write the definition of a class  ContestResult containing: An data member winner of type  string , initialized...

    C++ Write the definition of a class  ContestResult containing: An data member winner of type  string , initialized to the empty string . An data member secondPlace of type  string , initialized to the empty string . An 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...

  • Write a full class definition for a class named Player , and containing the following members: A data member name of t...

    Write a full class definition for a class named Player , and containing the following members: A data member name of type string . A data member score of type int . A member function called setName that accepts a parameter and assigns it to name . The function returns no value. A member function called setScore that accepts a parameter and assigns it to score . The function returns no value. A member function called getName that accepts no...

  • c++ class and member function

    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 emptystring. 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 memberfunction called setWinner that has one parameter, whose value it assigns to the data member winner

  • Python Write the definition of a class Counter containing: An instance variable named counter of type...

    Python Write the definition of a class Counter containing: An instance variable named counter of type int An instance variable named limit of type int. A constructor that takes two int arguments and assigns the first one to counter and the second one to limit A method named increment. It does not take parameters or return a value; if the instance variable counter is less than limit, increment just adds one to the instance variable counter. A method named decrement....

  • Java Write a class named CheckingAccount containing: An instance variable named balance of type double, initialized...

    Java Write a class named CheckingAccount containing: An instance variable named balance of type double, initialized to 0. A method named deposit that accepts a parameter of type double. The value of the balance instance variable is increased by the value of the parameter. A method named withdraw that accepts a parameter of type double. The value of the balance instance variable is decreased by the value of the parameter. A method named getBalance that accepts no parameters, returns the...

  • Code Lab Help (C++)

    Write the interface (.h file) of a class Player containing:A data member name of type string .A data member score of type int .A member function called setName that accepts a parameter and assigns it to name . The function returns no value.A member function called setScore that accepts a parameter and assigns it to score . The function returns no value.A member function called getName that accepts no parameters and returns the value of name .A member function called...

  • Write a class called Player that has four data members: a string for the player's name,...

    Write a class called Player that has four data members: a string for the player's name, and an int for each of these stats: points, rebounds and assists. The class should have a default constructor that initializes the name to the empty string ("") and initializes each of the stats to -1. It should also have a constructor that takes four parameters and uses them to initialize the data members. It should have get methods for each data member. It...

  • Write the implementation (.cpp file) of the GasTank class of the previous exercise. The full specification...

    Write the implementation (.cpp file) of the GasTank class of the previous exercise. The full specification of the class is: A data member named amount of type  double . An data member named capacity of type  double . A constructor that accepts a parameter of type  double . The value of the parameter is used to initialize the value of capacity. The constructor also sets amount to zero. A function named addGas that accepts a parameter of type  double . The value of the...

  • Write the implementation (.cpp file) // i cant figure out what it wants where the is a ? the...

    Write the interface (.h file) of a class Accumulator containing:A data member named sum of type integer.A constructor accepting an integer parameter.A function named getSum that accepts no parameters and returns an integer.A function named add that accepts an integer parameter and returns no value.class Accumulator{int sum;Accumulator(int);int getSum ();void add (int);};Write the implementation (.cpp file) of the Accumulator class of the previous exercise. The full specification of the class is:An data member named sum of type integer.A constructor that accepts...

  • This is the code I wrote for myprogramminglab It works for 8 out of 9 inputs they use and I...

    Write a full class definition for a class named GasTank , and containing the following members:A data member named amount of type double.A constructor that no parameters. The constructor initializes the data member amount to 0.A function named addGas that accepts a parameter of type double . The value of the amount instance variable is increased by the value of the parameter.A function named useGas that accepts a parameter of type double . The value of the amount data member...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT