Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Databases And Information Systems 1 International Baltic Conference Dbandis 2020 Tallinn Estonia June 19 2020 Proceedings

Authors: Tarmo Robal ,Hele-Mai Haav ,Jaan Penjam ,Raimundas Matulevicius

1st Edition

303057671X, 978-3030576714

More Books

Students also viewed these Databases questions

Question

What are five different ways imagery can be used by athletes?

Answered: 1 week ago

Question

What is Accounting?

Answered: 1 week ago

Question

Define organisation chart

Answered: 1 week ago

Question

What are the advantages of planning ?

Answered: 1 week ago