Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Create a C++ project with 2 classes, Person and Birthdate. The description for e

ID: 3694016 • Letter: C

Question

Create a C++ project with 2 classes, Person and Birthdate. The description for each class is shown below:

Birthdate class:

private members: year, month and day

public members: copy constructor, 3 arguments constructor, destructor, setters, getters and age (this function should return the age)

Person class:

private members: firstName, lastName, dateOfBirth, SSN

public members: 4 arguments constructor (firstName, lastName, datOfBirth and SNN), destructor and printout

Implementation:

- use the separated files approach

- implement all the methods for the 2 classes

- make sure to use the member initialization list

create 3 objects and test the implemented methods.

Explanation / Answer

Program

#include "stdafx.h"
#include "person.h"
Person::Person (char* fName, char* lName, char* SSN, int Birth_Year,
int Birth_Month, int Birth_Day){
fName = "";
lName = "";
SSN = "000000000";
Birth_Year = 0000;
Birth_Month = 00;
Birth_Day = 00;
}
int Person::findLength (){
int len = 0;
char *s=value;
for (;s!=''; s++, len++);
return len;
}
bool Person::validateSSN (char* soc){
value = soc;
Length = findLength();
if (Length < 9 && Length > 9)
return false;
else if (Length == 9)
return true;
}
void Person::SetfName (char* first){
fName = first;
}
void Person::SetlName (char* last){
lName = last;
}
void Person::SetSSN (char* soc){
SSN = soc;
}
void Person::SetBirth_Year (int byr){
Birth_Year = byr;
}
void Person::SetBirth_Month (int bmo){
Birth_Month = bmo;
}
void Person::SetBirth_Day (int bdy){
Birth_Day = bdy;
}
char* Person::GetfName (){
return fName;
}
char* Person::GetlName (){
return lName;
}
char* Person::GetSSN (){
return SSN;
}
int Person::GetBirth_Year (){
return Birth_Year;
}
int Person::GetBirth_Month (){
return Birth_Month;
}
int Person::GetBirth_Day (){
return Birth_Day;
}