Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Big Data Fundamentals Concepts, Drivers & Techniques

Authors: Thomas Erl, Wajid Khattak, Paul Buhler

1st Edition

0134291204, 9780134291208

More Books

Students also viewed these Databases questions