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

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

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);

 

NOTE : SEND SCREEN SHORT OF OUTPUT SCREEN AND CODE AS WILL IN COMPLIER

 

Sample Output
Nane
Ahnad
Ahnad
Departnent
Accounts
Net Pay
19000
19000
23250
10000
Arsalan Adninistration 31500
Accounts
10
3
Ayesha Accounts
Hassan Adninistration
Press any key to continue
Transcribed Image Text:Sample Output Nane Ahnad Ahnad Departnent Accounts Net Pay 19000 19000 23250 10000 Arsalan Adninistration 31500 Accounts 10 3 Ayesha Accounts Hassan Adninistration Press any key to continue
Expert Solution
steps

Step by step

Solved in 2 steps

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