Example 12-9 defined a class personType to store the name of a person. The membe
ID: 3644570 • Letter: E
Question
Example 12-9 defined a class personType to store the name of a person.The member functions that we included merely print the name and set the
name of a person. Redefine the class personType so that, in addition to
what the existing class does, you can:
a. Set the first name only.
b. Set the last name only.
c. Store and set the middle name.
d. Check whether a given first name is the same as the first name of this person.
e. Check whether a given last name is the same as the last name of this person.
Write the definitions of the member functions to implement the operations
for this class. Also, write a program to test various operations on this class
Explanation / Answer
#include using namespace std; #include "Unknown.h" int main() { personType first("Unknown"); first.print(); personType middle; middle.print(); personType last; last.print(); firstperson.checkfirst("James"); lastperson.checkfirst("Berry"); coutRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.