Question: In the Contestant class, complete the function definition for SetName() that takes in the string parameter newName. Ex: If the input is 7.5 42 Ralitza,

In the Contestant class, complete the function definition for SetName() that takes in the string parameter newName.

Ex: If the input is 7.5 42 Ralitza, then the output is:

Height: 7.5 Age: 42 Name: Ralitza

#include using namespace std;

class Contestant { public: void SetHeight(double newHeight); void SetAge(int newAge); void SetName(string newName); double GetHeight() const; int GetAge() const; string GetName() const; private: double height; int age; string name; };

void Contestant::SetHeight(double newHeight) { height = newHeight; }

void Contestant::SetAge(int newAge) { age = newAge; }

/* Your code goes here */ { name = newName; }

double Contestant::GetHeight() const { return height; }

int Contestant::GetAge() const { return age; }

string Contestant::GetName() const { return name; }

int main() { Contestant contestant1; double inputHeight; int inputAge; string inputName;

cin >> inputHeight; cin >> inputAge; cin >> inputName;

contestant1.SetHeight(inputHeight); contestant1.SetAge(inputAge); contestant1.SetName(inputName); cout << "Height: " << contestant1.GetHeight() << endl; cout << "Age: " << contestant1.GetAge() << endl; cout << "Name: " << contestant1.GetName() << endl;

return 0; }

c++ and please please make it correct

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!