1) Design and implement a class Person. Each object of the class person contains the FirstName and LastName of type character pointer and Age of type int. Besides, the following member functions:
1.Two overloaded constructors - a default constructor with no argument and a constructor that takes two arguments of type character pointer for FirstName and LastName, and integer argument for Age. If the age is less than or equal to 0 or greater than 110, it needs to set the age field value to 1.
2.Method named getFirstName without any parameters, it needs to return the value of the FirstName field.
3.Method named getLastName without any parameters, it needs to return the value of the LastName field.
4.Method named getAge without any parameters, it needs to return the value of the age field.
5.Method named setFirstName with one parameter of type character pointer, it needs to set the value of the FirstName field.
6.Method named setLastName with one parameter of type character pointer, it needs to set the value of the LastName field.
7.Method named setAge with one parameter of type int, it needs to set the value of the age field. If the parameter is less than or equal to 0 or greater than 110, it needs to set the age field value to 1.
8.Method named isTeenager without any parameters, it needs to return true if the value of the age field is greater than 12 and less than 20, otherwise, return false.
2) Write a single C++ statement that declares P1 to be a Person object, and initialize its first name to "Ahmad", last name to "Khalid", and age to 18.
3) Write a single C++ statement that outputs the data stored in the object P1. The output should be like: Ahmad Khalid - age: 18
4) Write C++ statements that determine whether the P1 is a teenager. If it is, print "Is a teenager", otherwise print "Is not a teenager"
Please note that this is not a homework site. We won't do your homework for you. The purpose of homework is that you learn by doing. However we are always willing to help solve problems you encountered, correct mistakes you made in your code and answer your questions.
We didn't see your attempts to solve this problem yourself and so we cannot correct mistakes you didn't made and answer questions you didn't ask. To get help you should do something yourself and get real problems with something. If your problem is "I don't understand a thing", then you should go back to basics and study again.
It is indeed gratifying to find that you know all that.
Have no fear. I most sincerely didn't want to create the impression that you didn't know 'that' and you have now, more than adequately, allayed my initial concern that you possibly didn't know anything at all.
So, moving forward, the best strategy now is to quickly submit what you do know, including 'that', and avoid trying to find out what everybody else knows, or, even worse, what they don't know which could be voluminous and time-consuming to say the least.