1. Create a class person having 5 data members. • Name • Address • Cnic • Gender • Age All data members should be hidden by the use of data hiding concept. These values will be initialize using the child class constructor. For getting the values of these data members getter method will be created for all data members in the parent class i-e Person. 2. Create another class Teacher that will inherit properties and functionalities from person class. Teacher class will have experience data member and an array of subjects taught by that particular teacher. 3. Provide setter and getter methods for all data members. 4. Teacher is allowed to teach at least 2 subjects. 5. Perform input validation in setSubject() function so the user will not be able to input anything except string value. 6. Default experience of the teacher will be 2 years. 7. Parameterized constructor of person class will be called using the teacher class constructor. This will initialize all the data members of person class. 8. Using teacher class object display every info of teacher.

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question
The following question is C++ Program I have given all the information about question below please solve it correctly please.
1. Create a class person having 5 data members.
Name
Address
Cnic
Gender
Age
All data members should be hidden by the use of data hiding concept. These values will be
initialize using the child class constructor. For getting the values of these data members getter
method will be created for all data members in the parent class i-e Person.
2. Create another class Teacher that will inherit properties and functionalities from person
class. Teacher class will have experience data member and an array of subjects taught by
that particular teacher.
3. Provide setter and getter methods for all data members.
4. Teacher is allowed to teach at least 2 subjects.
5. Perform input validation in setSubject() function so the user will not be able to input
anything except string value.
6. Default experience of the teacher will be 2 years.
7. Parameterized constructor of person class will be called using the teacher class
constructor. This will initialize all the data members of person class.
8. Using teacher class object display every info of teacher.
Output will be something like this if all points are implemented correctly.
Name of teacher is : RandomTeacher
Age of teacher is : 27
Cnic of teacher is : 883729439
gender of teacher is : male
Experience of teacher is : 2 years
How many subjects are thaought by you :
Invalid input.
Invalid input.
f
Try again: g
Try again:
3.
Enter subjects name: physics
Enter subjects name: chemistry
Enter subjects name:
urdu
Subjects taught by the teacher are : physics
, chemistry ,
urdu
Transcribed Image Text:1. Create a class person having 5 data members. Name Address Cnic Gender Age All data members should be hidden by the use of data hiding concept. These values will be initialize using the child class constructor. For getting the values of these data members getter method will be created for all data members in the parent class i-e Person. 2. Create another class Teacher that will inherit properties and functionalities from person class. Teacher class will have experience data member and an array of subjects taught by that particular teacher. 3. Provide setter and getter methods for all data members. 4. Teacher is allowed to teach at least 2 subjects. 5. Perform input validation in setSubject() function so the user will not be able to input anything except string value. 6. Default experience of the teacher will be 2 years. 7. Parameterized constructor of person class will be called using the teacher class constructor. This will initialize all the data members of person class. 8. Using teacher class object display every info of teacher. Output will be something like this if all points are implemented correctly. Name of teacher is : RandomTeacher Age of teacher is : 27 Cnic of teacher is : 883729439 gender of teacher is : male Experience of teacher is : 2 years How many subjects are thaought by you : Invalid input. Invalid input. f Try again: g Try again: 3. Enter subjects name: physics Enter subjects name: chemistry Enter subjects name: urdu Subjects taught by the teacher are : physics , chemistry , urdu
Expert Solution
steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY