Question: Define the Person class's GetName ( ) accessor that gets data member name and the GetHeight ( ) accessor that gets data member height. Ex:
Define the Person class's GetName accessor that gets data member name and the GetHeight accessor that gets data member height.
Ex: If the input is Fay then the output is:
Person: Fay
Height: feet#include
#include
#include
using namespace std;
class Person
public:
void SetNamestring personName;
void SetHeightdouble personHeight;
string GetName const;
double GetHeight const;
private:
string name;
double height;
;
void Person::SetNamestring personName
name personName;
void Person::SetHeightdouble personHeight
height personHeight;
int main
Person person;
string inputName;
double inputHeight;
cin inputName;
cin inputHeight;
person.SetNameinputName;
person.SetHeightinputHeight;
cout "Person: person.GetName endl;
cout "Height: fixed setprecision person.GetHeight feet" endl;
return ;
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
