Question: Given the following class : class person { // Class Declaration public: void setName(string); void setAge(int); string getName(); int getAge(); void printPerson(); person(string aName, int

Given the following class : class person { // Class Declaration public: void setName(string); void setAge(int); string getName(); int getAge(); void printPerson(); person(string aName, int anAge); private: string name; int age; }; // setAge, setName, getAge, getName and person are implemented, but not shown Write the printPerson function in the person class so that the output looks as the following: xxxx is an adult or xxxx is a teen ager or xxxx is a child where xxxx is the person object's name if the person is 20 years or older, then the person is an adult if the person is 13 - 19 years, then the person is a teen ager otherwise, the person is a child. Note: printPerson is a function inside the person class. It should be able to access all private members directly.

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!