C++ Question
Need help with this assignment?Get an original answer from a qualified tutor — from $10/page.
Get it written →In c++, define 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:
- Set the first name only.
- Set the last name only.
- Store and set the middle name.
- Check whether a given first name is the same as the first name of this person.
- 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.
Task #01: isFirstName correctly determines if a name is a student’s first name
Task #02: isLastName correctly determines if a name is a student’s first name
Task #03: The program can initialize a personType object without error
Task #04: personType getters and setters work as expected
personType.h header file contains the following:
#ifndef PERSON_TYPE_H
#define PERSON_TYPE_H
#include <string>
using namespace std;
class personType
{
public:
void print() const;
void setName(string first, string middle, string last);
void setLastName(string last);
void setFirstName(string first);
void setMiddleName(string middle);
bool isLastName(string last) const;
bool isFirstName(string first) const;
string getFirstName() const;
string getMiddleName() const;
string getLastName() const;
personType(string first = “”, string middle = “”, string last = “”);
private:
string firstName;
string middleName;
string lastName;
};
#endif
Get a plagiarism-free answer to this question
Send us your instructions and we’ll match you with the best writer in your subject.
- 100% human-written, zero AI
- Turnitin report included
- Confidential — we never share your data
- Free revisions & refunds