Write a C++ program which creates a Class named as Person which represents a person by its Id (it must be unique),  Name,  Age,  Address and  Phone no.    This class should have a parameterized constructor and destructor, the getter/setter functions and a showoutput () member function that prints the information of a Person object.    PART A Create a Class named as Student that inherits publicly from class Person. A Student object is  distinguished by the same attributes as a Person object plus his  Course name,  Room no (which is allocated to him) and  GPA.     This class should also have parameterized constructor and default destructor, setter/getter functions and a showoutput () member function.    Your input should be similar to the following:  *-*-*-**-*-*-*-*-*-*-*-*-*  Enter Student's Information  *-*-*-**-*-*-*-*-*-*-*-*-*  Enter the Roll No:                                                                             1 Enter the Name of the Person:                                   khuram Enter the Age of the Person:                                                        23 Enter the Address of the Person:                                               lahore Enter the Phone No of the Person:                                            234566 Enter the Course Discipline of the Person [CS/IT]:              CS  Enter the Room No of the Person:                                             2 Enter the GPA of the Person:                                                       3.5   Your output should be similar to the following:    *-*-*-*-*-*-*-*-*-*  Student's Data  *-*-*-*-*-*-*-*-*-*  Student Id:                                                         1 Student Name:                                 khuram  Student Age:                                                     23 Student Address:                                              lahore Student Phone Number:                               234566  Student Course Discipline [CS/IT]:             CS  Student's Room No:                                        2  Student's GPA:                                 3.5

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

Write a C++ program which creates a Class named as Person which represents a person by its Id (it must be unique), 

Name, 

Age,  Address and  Phone no. 

 

This class should have a parameterized constructor and destructor, the getter/setter functions and a showoutput () member function that prints the information of a Person object. 

 

PART A

Create a Class named as Student that inherits publicly from class Person. A Student object is 

distinguished by the same attributes as a Person object plus his 

Course name, 

Room no (which is allocated to him) and  GPA. 

 

 This class should also have parameterized constructor and default destructor, setter/getter functions and a showoutput () member function. 

 

Your input should be similar to the following: 

*-*-*-**-*-*-*-*-*-*-*-*-* 

Enter Student's Information 

*-*-*-**-*-*-*-*-*-*-*-*-* 

Enter the Roll No:                                                                             1

Enter the Name of the Person:                                   khuram

Enter the Age of the Person:                                                        23

Enter the Address of the Person:                                               lahore

Enter the Phone No of the Person:                                            234566

Enter the Course Discipline of the Person [CS/IT]:              CS 

Enter the Room No of the Person:                                             2

Enter the GPA of the Person:                                                       3.5

 

Your output should be similar to the following: 

 

*-*-*-*-*-*-*-*-*-* 

Student's Data 

*-*-*-*-*-*-*-*-*-* 

Student Id:                                                         1

Student Name:                                 khuram 

Student Age:                                                     23

Student Address:                                              lahore

Student Phone Number:                               234566 

Student Course Discipline [CS/IT]:             CS 

Student's Room No:                                        2 

Student's GPA:                                 3.5 

 

 

PART B

Similarly, also develop a Class named as Employee that inherits publicly from class Person. An Employee object is distinguished by the same attributes as a Person object plus his 

Department name, 

Gross salary, 

Tax percentage and Net salary. 

 

 This class should also have a parameterized constructor, default destructor, setter/getter functions and a showoutput () member function. 

Your program should ask the user about the all the information required for Employee. 

 

Your input should be similar to the following: 

*-*-*-**-*-*-*-*-*-*-*-*-* 

Enter Employee's Information 

*-*-*-**-*-*-*-*-*-*-*-*-* 

Enter the Employee Id:                                  1

Enter the Name of the Person:                   kamran 

Enter the Age of the Person:                                        32

Enter the Address of the Person:                               karachi

Enter the Phone No of the Person:                            234567

Enter the Department of the Person:                       CS Enter the Gross Salary of the Person:       30000 

Enter the Tax Percentage of the Person:                 15 

 

Your output should be similar to the following: 

*-*-*-*-*-*-*-*-*-* 

Employee's Data 

*-*-*-*-*-*-*-*-*-* 

Employee Id:                     1 

 

Employee Name:             

Employee Age:                32 

kamran  

Employee Address:           

karachi  

Employee Phone Number:     

234567  

Employee Department:         

CS 

Employee's Gross Salary:     

30000 with 15 % of Tax 

Employee's Net Salary:       

25500 

 

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Knowledge Booster
ADT and Class
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education