//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;}
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;}
Write a full class definition for a class named ContestResult , and containing the following members:...
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 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...
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 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 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...
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, 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 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 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...
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...