Create a class named employee with the
following member:
Data members: employeecode of String type
Name of String type
basicSalary of double type
netSalary to double type
Member Method:
i) Constructor to initialise employee code,
Name and basicSalary.
ii) Display all the details.
iii) Compute the netSalary by using the
following formula:
Net Salary=DA+HRA+basicSalary-(PF+IT)
DA=55% of basic salary.
HRA=20% of basic salary.
PF=1000
IT=2% of gross salary.
Where gross salary=DA+HRA+basic salary
Answers
Create A Class (named Employee). Each Employee Will Have Four Data Members: (i) Name Of The ...
Question: Create A Class (named Employee). Each Employee Will Have Four Data Members: (i) Name Of The Employee (string Type), (ii) Emp_ID (Employee ID - Integer Type), (iii) Gross_Salary (annual Salary) Of The Employee (Integer Type) (iv) Retire_Amt (Annual Retirement Contribution By The Employee - Double Type). All The Member Data Members Should Be Defined As ...
This problem has been solved!
See the answer
Create a class (named Employee). Each employee will have four data members: (i) Name of
the employee (string type), (ii) Emp_ID (Employee ID - integer type), (iii) Gross_Salary
(annual salary) of the employee (Integer type) (iv) Retire_Amt (Annual Retirement
Contribution by the employee - double type). All the member data members should be
defined as private.
The Employee class 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
The Retire_Amt will be computed as 6% of the Gross Salary amount.
DisplayEmp:
- Display the Name, Employee ID, Gros Salary and Retirement Contributions in separate
lines
- Display monthly salary by dividing Gross Salary by 12
- Display net Salary by subtracting retirement contribution from gross salary
GetSalary:
- Returns the Gross Salary of the Employee
GetRet:
- Returns the Retirement contribution of the Employee
Test your class (invoke the public member functions of the class in the main function and display
the results with appropriate messages) by creating five different employee objects for a small
business in the main function (prompt the user to enter the data for creating the employee objects).
Expert Answer
#include <iostream> #include <iomanip> using namespace std; //Creating an Employee class class Employee { private : //Declaring instance variables string name; int Emp_ID; int Gross_view the full answer
Previous questionNext question
Get more help from Chegg
Get 1:1 help now from expert Computer Science tutors
COMPANY
LEGAL & POLICIES
CHEGG PRODUCTS AND SERVICES
CHEGG NETWORK
CUSTOMER SERVICE
  
© 2003-2020 Chegg Inc. All rights reserved.