Write the following program in C++. 1. Create a class called Employee that includes attributes: empid, name, points, group, and avg with data types: “int”, “String”, “double”, “String”, and “double” respectively. 2. Include a constructor with parameters: empid and name. 3. Include another constructor to assign default values to the attributes. 4. Include a function called addPoints that is used to add a given amount to the value of the attribute points. 5. Include a function called upgradePoints that is used to increase the value of the attribute points by a given percentage. 6. Include a function called removePoints that is used to reduce a given amount from the value of the attribute points. If the resultant value is negative then the value of the attribute should be set into zero. 7. Include a function called computeGroup that assigns a value to the attribute group based on the value of the attribute points as given in the following table. Points Group points < 100 Silver 100 ≤ points < 500  Gold 500 < points ≤ 2000 Platinum 2000 < points Diamond 8. Include a function called display to display the values of all the attributes of a Employee object. 9. Include a static function called getBest that returns the value of the attribute id of the Employee with maximum number of points. 10. Create an array in main function that holds five Employee objects. Assign the objects given in the following table to each array element using the parameterized constructor. Attributes Obj[0] Obj[1] Obj[2] Obj[3] Obj[4] ID 1543     6561 6954 3485 8546 Name Adil Waseem Ayesha Adnan Wajid 11. Use the function addPoints to add following points respectively to each Employee object created above. 129 785 3258 59 1652 12. Add extra 1000 points to the third employee using the function addPoints. 13. Increase the points of the second employee by 2% using the function upgradePoints. 14. Include a function called display to the that displays all the attributes of each Employee. Each set of attributes should be separated by a sequence of dots. The part of output for the first Employee is given below. …………………………… Employee: 1 ID: 1543 Name: Nimal Points: 129.0 Group: null Average: 0.0 15. Call the function display, 16. Compute the group of each Employee using the function computeGroup. You should use a loop. 17. Again, call the function display. 18. Display the value of the attribute id of the Employee with highest number of points using the function getBest. 19. Create a reference variable called emp of type Employee. 20. Assign fifth Employee object to the reference variable emp. You should use the object you have already created. 21. Reduce 2000 points from the fifth Employee using the function removePoints. You should call the function using the reference variable emp. 22. Call the function display of the class Employee using the array element c[4] to display the values of attributes of the fifth Employee. 23. Update the group of the fifth Employee invoking the function computeGroup. 24. Create a Employee object with default values to its attributes by using the appropriate constructor. The object should be assigned to the reference variable emp. 25. Copy the values of the attributes of the fourth Employee to the corresponding attributes of the object pointed by the reference variable emp. 26. Create another reference variable called emp1 of type Employee. 27. Assign the object pointed by the reference variable emp to emp1 as well. 28. call the function display for objects pointed by variable emp and emp1.

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

Write the following program in C++.

1. Create a class called Employee that includes attributes: empid, name, points,
group, and avg with data types: “int”, “String”, “double”, “String”, and “double”
respectively.
2. Include a constructor with parameters: empid and name.
3. Include another constructor to assign default values to the attributes.
4. Include a function called addPoints that is used to add a given amount to the value
of the attribute points.
5. Include a function called upgradePoints that is used to increase the value of the
attribute points by a given percentage.
6. Include a function called removePoints that is used to reduce a given amount from
the value of the attribute points. If the resultant value is negative then the value of
the attribute should be set into zero.
7. Include a function called computeGroup that assigns a value to the attribute group
based on the value of the attribute points as given in the following table.

Points Group

points < 100

Silver
100 ≤ points < 500  Gold
500 < points ≤ 2000 Platinum
2000 < points Diamond

8. Include a function called display to display the values of all the attributes of a Employee object.
9. Include a static function called getBest that returns the value of the attribute id of the Employee with maximum number of points.
10. Create an array in main function that holds five Employee objects. Assign the objects given in the following table to each array element using the parameterized constructor.

Attributes Obj[0] Obj[1] Obj[2] Obj[3] Obj[4]
ID 1543     6561 6954 3485 8546
Name Adil Waseem Ayesha Adnan Wajid

11. Use the function addPoints to add following points respectively to each Employee object created above.

129 785 3258 59 1652

12. Add extra 1000 points to the third employee using the function addPoints.
13. Increase the points of the second employee by 2% using the function
upgradePoints.
14. Include a function called display to the that displays all the attributes of each Employee. Each set of attributes should be separated by a sequence of dots. The part of output for the first Employee is given below.

……………………………
Employee: 1
ID: 1543
Name: Nimal
Points: 129.0
Group: null
Average: 0.0

15. Call the function display,
16. Compute the group of each Employee using the function computeGroup. You should use a loop.
17. Again, call the function display.
18. Display the value of the attribute id of the Employee with highest number of points using the function getBest.
19. Create a reference variable called emp of type Employee.
20. Assign fifth Employee object to the reference variable emp. You should use the object you have already created.

21. Reduce 2000 points from the fifth Employee using the function removePoints. You should call the function using the reference variable emp.
22. Call the function display of the class Employee using the array element c[4] to display the values of attributes of the fifth Employee.
23. Update the group of the fifth Employee invoking the function computeGroup.
24. Create a Employee object with default values to its attributes by using the appropriate constructor. The object should be assigned to the reference variable emp.
25. Copy the values of the attributes of the fourth Employee to the corresponding attributes of the object pointed by the reference variable emp.
26. Create another reference variable called emp1 of type Employee.
27. Assign the object pointed by the reference variable emp to emp1 as well.

28. call the function display for objects pointed by variable emp and emp1.

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 1 images

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