C++ Question
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
Collepals.com Plagiarism Free Papers
Are you looking for custom essay writing service or even dissertation writing services? Just request for our write my paper service, and we'll match you with the best essay writer in your subject! With an exceptional team of professional academic experts in a wide range of subjects, we can guarantee you an unrivaled quality of custom-written papers.
Get ZERO PLAGIARISM, HUMAN WRITTEN ESSAYS
Why Hire Collepals.com writers to do your paper?
Quality- We are experienced and have access to ample research materials.
We write plagiarism Free Content
Confidential- We never share or sell your personal information to third parties.
Support-Chat with us today! We are always waiting to answer all your questions.
