Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started