Please help me on C++ Using codeblocks 1. Design the class doctorType, inherited
ID: 645242 • Letter: P
Question
Please help me on C++ Using codeblocks
1. Design the class doctorType, inherited from the class personType, defined in the book
(Chapter 11 or 12), with an additional data member to store a doctor
Explanation / Answer
#include
#include
using namespace std;
class personTypeImpl
{
public:
void print() const;
void SetName(string first, string last);
string getFirstName() const;
string getLastName() const;
personTypeImpl(string first = "", string last = "");
private:
string FirstName, LastName;
};
void personTypeImpl :: print() const
{
cout << FirstName << " " << LastName << endl;
}
void personTypeImpl :: SetName(string first, string last)
{
FirstName = first;
LastName = last;
cout << "Please Enter Your FIRST Name. ";
cin >> first;
cout << "Please Enter Your LAST Name. ";
cin >> last;
}
string personTypeImpl :: getFirstName() const
{
return FirstName;
}
string personTypeImpl :: getLastName() const
{
return LastName;
}
personTypeImpl :: personTypeImpl(string first, string last)
{
FirstName = first;
LastName = last;
}
/************************/
#include
#include
using namespace std;
class patientTypeImpl : public personTypeImpl
{
public:
void print() const;
void SetName(string first, string last);
void SetPatientID(int ID);
void SetPatientAge(int Age);
int getPatientAge() const;
int getPatientID() const;
string getFirstName() const;
string getLastName() const;
patientTypeImpl(string first = "", string last = "");
patientTypeImpl(int ID);
patientTypeImpl(int Age);
private:
string FirstName, LastName;
int PatientID, PatientAge;
};
int patientTypeImpl::getPatientID() const
{
return PatientID;
}
int patientTypeImpl::getPatientAge() const
{
return PatientAge;
}
patientTypeImpl::patientTypeImpl(string first = "", string last = "")
{
FirstName = first;
LastName = last;
}
patientTypeImpl::patientTypeImpl(int ID)
{
PatientID = ID;
}
patientTypeImpl::patientTypeImpl(int Age)
{
PatientAge = Age;
}
*****************
#include
#include
using namespace std;
class doctorTypeImpl : public personTypeImpl
{
public:
void SetName(string first, string last);
void SetSpeciality(string Special);
string getSpeciality() const;
string getFirstName() const;
string getLastName() const;
doctorTypeImpl(string Special = "");
private:
string FirstName, LastName, Speciality;
};
void doctorTypeImpl :: SetSpeciality(string Special)
{
Speciality = Special;
cout << "Please Enter Your SPECIALITY. ";
cin >> Special;
}
string doctorTypeImpl :: getSpeciality() const
{
return Speciality;
}
doctorTypeImpl :: doctorTypeImpl(string Special = "")
{
Speciality = Special;
}
******************************
#include
#include
using namespace std;
class dateTypeImpl
{
public:
void printDate() const;
void SetDate(int Day, int Month, int Year);
int getTheDay() const;
int getTheMonth() const;
int getTheYear() const;
dateTypeImpl(int Day,int Month, int Year);
private:
int TheDay, TheYear, TheMonth;
};
void dateTypeImpl :: printDate() const
{
cout << TheDay << " " << TheMonth << " " << TheYear << endl;
}
void dateTypeImpl :: SetDate(int Day, int Month, int Year)
{
TheDay = Day;
TheMonth = Month;
TheYear = Year;
cout << "Please Enter The Day (DD). ";
cin >> Day;
cout << "Please Enter The Month (MM). ";
cin >> Month;
cout << "Please Enter The Year (YYYY). ";
cin >> Year;
}
int dateTypeImpl :: getTheDay() const
{
return TheDay;
}
int dateTypeImpl :: getTheMonth() const
{
return TheMonth;
}
int dateTypeImpl :: getTheYear() const
{
return TheYear;
}
dateTypeImpl::dateTypeImpl(int Day, int Month, int Year)
{
TheDay = Day;
TheMonth = Month;
TheYear = Year;
}
class DateOfBirthType : public dateTypeImpl
{
public:
void printDOB() const;
void SetDOB(int Day, int Month, int Year);
int getTheDay() const;
int getTheMonth() const;
int getTheYear() const;
private:
int TheDay, TheYear, TheMonth;
};
void DateOfBirthType :: printDOB() const
{
cout << "Patients Date Of Birth: " << TheDay << "/" << TheMonth << "/" << TheYear << endl;
}
void DateOfBirthType :: SetDOB(int Day, int Month, int Year)
{
TheDay = Day;
TheMonth = Month;
TheYear = Year;
cout << "Enter The Patients DAY Of Birth. ";
cin >> Day;
cout << "Enter The Patients MONTH Of Birth. ";
cin >> Month;
cout << "Enter The Patients YEAR Of Birth. ";
cin >> Year;
}