Question: Develop a C++ program to create the following classes: (i) Employee : Each employee will have three data members: (i) Name of string type, (ii)
Develop a C++ program to create the following classes:
(i) Employee: Each employee will have three data members: (i) Name of string type, (ii) Emp_ID (Employee ID) of integer type, (iii) Salary (annual salary) of Integer type. The member data members must be protected. It will have the following public member functions:
Constructor with following parameters:
- A pointer to a string to initialize the Name of the employee
- Integer to initialize the Emp_ID
- Integer to initialize Salary
DisplayEmp:
- Output the Name, Employee ID, Salary and Retirement Contributions in separate lines
- Output monthly gross salary of the employee by dividing Salary by 12
- Output net Salary of the employee by subtracting retirement contribution from gross salary
GetSalary:
- Returns the Salary of the Employee
(ii) Customer: Each bank customer will have three data members: (i) Address of string type, (ii) Customer_ID of integer type, (iii) Account_Balance of double type. The member data members must be protected. It will have the following public member functions:
Constructor with following parameters:
- A pointer to a string to initialize the Address of the customer
- Integer to initialize the Customer_ID
- Integer to initialize Account_Balance
DisplayCustomer:
- Output the Customer ID, Address, and Salary and Account Balance in separate lines
GetAccBalance:
- Returns the Account balance of the Customer
(iii) Citizen: Inherits (Public inheritance) from Employee and Customer classes
a. It has no additional data members
b. Include member functions as needed
c. Leverage the member functions through inheritance
Test your class by creating five different Citizen Objects (ask the user to input the data for the Citizen Objects) in the main function.
Display Name, Address, Salary and Account Balance of the Citizen objects.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
