Write a C++ program as follows,
1. Create a class called Employee that includes attributes: empid (int), name (string), points (double), group (string), and avg (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 attritute (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 (points) should be set into zero.
7. include a function called computeGroup that assign a value to the attribute (group) based on the value of the attribute (points) as given in the following table.
attribute (points) |
attribute (group) |
point<> |
Silver |
100<><> |
Gold |
500<><> |
Platinum |
2000<> |
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 (class) objects. assign the objects given in the following table to each array element using the parameterized constructor.
Attribute |
Object [0] |
Object [1] |
Object [2] |
Object [3] |
Object [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.
12. Add extra 1000 points to the third Employee object using the function addPoints.
13. Increase the points of the second Employee object by 2% using the function upgradePoints.
14. Include a function called display that displays all the attributes of each Employee object. Each set of attributes should be separated by a sequence of dots. The part of ouput for the first Employee object is given below