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 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
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
Get step-by-step solutions from verified subject matter experts
