//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....
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...
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 definition of a class car containing: 1. A data member named model of type string. 2. A data member named year of type integer. 3. A data member named mileage of type double. 4. A member method to display the fields model, year, and mileage on the standard output. For c++
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 a class named GasTank containing: An instance variable named amount of type double, initialized to 0. A method 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 method named useGas that accepts a parameter of type double. The value of the amount instance variable is decreased by the value of the parameter. However, if the value of amount is decreased below 0, amount...
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...