Question: Define the Person class's SetName() mutator that sets data member name to personName and the SetHeight() mutator that sets data member height to personHeight. Ex:

 Define the Person class's SetName() mutator that sets data member name

Define the Person class's SetName() mutator that sets data member name to personName and the SetHeight() mutator that sets data member height to personHeight.

Ex: If the input is Ina 3.0, then the output is:

Person: Ina Height: 3.0 feet

in C++ please!

code:

#include #include #include using namespace std;

class Person { public: void SetName(string personName); void SetHeight(double personHeight); void Print() const; private: string name; double height; };

/* Your code goes here */

void Person::Print() const { cout

int main() { Person person; string inputName; double inputHeight;

cin >> inputName; cin >> inputHeight; person.SetName(inputName); person.SetHeight(inputHeight);

person.Print();

return 0; }

Define the Person class's SetName0 mutator that sets data member name to personName and the SetHeight0 mutator that sets data member height to personHeight. Ex: If the input is Ina 3.0, then the output is: Person: Ina Height: 3.0 feet \begin{tabular}{r|c} 1 & \#include \\ 2 & \#include \\ 3 & \#include \\ 4 & using namespace std; \\ 5 & \\ 6 & class Person \{ \\ 7 & public: \\ 8 & void SetName(string personName); \\ 9 & void SetHeight(double personHeight); \\ 10 & void Print() const; \\ 11 & private: \\ 12 & string name; \\ 13 & double height; \\ 14 & 3; \\ 15 & \end{tabular}

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!