Q#01: In this assignment you will be creating a class named Employee. Employee class has the following data members: Employee ID. Employee Name Department Employee Salary Static data member which will hold the value of total no. of employees     Employee class must have the following member functions: Function Description Employee() Default constructor for Employee class, which will set employee id  to 0, employee name to NULL, employee department to NULL and salary to 0.0 Employee(int, char *, char *, float); It will take employee id, employee name, department and salary as arguments and initialize their values using member initializer list Employee(Employee &);  Copy constructor which will initialize one object with another object using deep copy Setter functions You have to define setter function for each data member which will take a value as an argument and set their values Getter functions You have to define getter function for each data member which will return the values of their data members calcNetPay() This function will calculate the net pay of an employee based on his salary display() This function will display the values of all data members of class ~Employee() Destructor of Employee class which will decrement the value of static data member of class   calcNetPay():  This function will calculate net pay of an employee based on his salary as: If salary is less than and equal to 10,000 then tax is 0. If salary is greater than 10,000 and less than equal to 20,000 then tax is 5%. If salary is greater than 20,000 and less than equal to 30,000 then tax is 7%. The tax on the salary greater than 30,000 is 10%. Note: On creation of each object, the value of static data member should be incremented. Within main () function, create an array of 5 objects of class Employee. Second object should be initialized with the first object.   Now, use for loop to call calcNetPay() and display() functions for each object.   You can create objects as follow: Employee emp1(5, "Ahmad", "Accounts", 20000 ); Employee emp2(emp1) ; Employee emp3(10, "Ayesha", "Accounts", 25000); Employee emp4(3, "Hassan", "Administration", 10000); Employee emp5(6,  "Arsalan", "Administration", 35000); Sample Output

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
100%

Q#01: In this assignment you will be creating a class named Employee.

Employee class has the following data members:

  • Employee ID.
  • Employee Name
  • Department
  • Employee Salary
  • Static data member which will hold the value of total no. of employees

 

 

Employee class must have the following member functions:

Function

Description

Employee()

Default constructor for Employee class, which will set employee id  to 0, employee name to NULL, employee department to NULL and salary to 0.0

Employee(int, char *, char *, float);

It will take employee id, employee name, department and salary as arguments and initialize their values using member initializer list

Employee(Employee &); 

Copy constructor which will initialize one object with another object using deep copy

Setter functions

You have to define setter function for each data member which will take a value as an argument and set their values

Getter functions

You have to define getter function for each data member which will return the values of their data members

calcNetPay()

This function will calculate the net pay of an employee based on his salary

display()

This function will display the values of all data members of class

~Employee()

Destructor of Employee class which will decrement the value of static data member of class

 

calcNetPay():  This function will calculate net pay of an employee based on his salary as:

If salary is less than and equal to 10,000 then tax is 0.

If salary is greater than 10,000 and less than equal to 20,000 then tax is 5%.

If salary is greater than 20,000 and less than equal to 30,000 then tax is 7%.

The tax on the salary greater than 30,000 is 10%.

Note: On creation of each object, the value of static data member should be incremented.

Within main () function, create an array of 5 objects of class Employee. Second object should be initialized with the first object.

 

Now, use for loop to call calcNetPay() and display() functions for each object.

 

You can create objects as follow:

Employee emp1(5, "Ahmad", "Accounts", 20000 );

Employee emp2(emp1) ;

Employee emp3(10, "Ayesha", "Accounts", 25000);

Employee emp4(3, "Hassan", "Administration", 10000);

Employee emp5(6,  "Arsalan", "Administration", 35000);

Sample Output

Sample Output
Nane
Ahnad
Ahnad
A yesha
Hassan
Arsalan Adninistration
Departnent
Accounts
Accounts
Accounts
Adninistration
Net Pay
19000
19000
23250
10000
31500
Press any key to continue
Transcribed Image Text:Sample Output Nane Ahnad Ahnad A yesha Hassan Arsalan Adninistration Departnent Accounts Accounts Accounts Adninistration Net Pay 19000 19000 23250 10000 31500 Press any key to continue
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
Data members
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