Question
Create class called person. This class has 3 data members as follows: o firstName : this data member holds the persons first name. o lastName:
Create class called person. This class has 3 data members as follows: o firstName : this data member holds the persons first name. o lastName: this data member holds the persons last name. o birthYear: this data member holds the year the person was born. You need to validate the birth year. Set the birth year to 1900 if a value of less than 1900 is provided and set it to 2017 if a value of more than 2017 is provided. All data members of the class must be private. Make sure you create the appropriate functions to access these data (get and set functions). You need to create a public member function of the class called getAge() which returns the age of the person. The age is calculated as the difference between the current year (2017) and the birth year. Make sure you separate the class interface from the class implementation. Do not forget to use the preprocessor wrappers (#ifndef, #define, #endif). Create a program to test this class. To complete the assignment, you need to submit a header file (class interface), .cpp (class implementation), and your program (.cpp file) . Also, you need to submit your application (.exe file).
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started