Questions by lbreitenberg - Page 8

Write a C++ program that maintains a collection of employees.Private data that is associated with an Employee class:Emp_IDAge (between 25-50)Salary_per_monthTotal_deductionsAnnual_salary_with_deductionsPublic functions that can be performed on Employee object:Default Constructor: (constructor without arguments). This should set 0 initially for the data members Emp_ID, Age, Salary_per_month, Total_deductions and Annual_salary_with_deductions for the object created without passing any values.Constructor: (constructor with arguments). This should set the values for the data members Emp_ID, Age and Salary_per_month as per users choice for the object created by using three values. But, the Total_deductions and Annual_salary_with_deductions data members alone should be set to 0 initially in this three parametrized constructor. While setting value to the member data "Age" validation should be performed to check whether the given age is between 25 and 50 only. If so, user input can be set as value to "Age". Otherwise, print "Invalid" and exit the program.Annual_Salary: This function should compute annual salary of the employee based on the "this" pointer after the following deductions from the annual salary.Deduction details:-Income tax: 10% from the annual salary.Educational chess: 5% from the annual salary.Professional tax: 3% from the annual salary.Then set Total_deductions (sum of income tax, educational chess and professional tax) and Annual_salary_with_deductions (Salary_per_month * 12 Total_deductions) of the employee by using "this" pointer and print the annual salary with the complete deduction details of the employees.Compare_emp: This function should compare two employees annual salaries after all deductions and find which employee is paid high. This function should carry two objects as arguments and after comparison, it should return an object from the function to the main function which is having the highly paid employee details.Print_emp: This function should displays all data members of the object passed as the argument to it.Note:-Write a main function that tests Employee class as follows:Create two objects of type Employee using argument constructor to initialize it member data as per users choice to Emp_ID, Age and Salary_per_month. But Total_deductions and Annual_salary should be set to 0 initially.Compute the annual salary for these employee objects and print the same with complete deduction details.Compare both the employees to find the highly paid employee.Display the details of the highly paid employee.You may decide the type of the member data as per the requirements.Output is case sensitive. Therefore, it should be produced as per the sample test case representations.Age should be between 25 and 50 only. Otherwise, print "Invalid".In samples test cases in order to understand the inputs and outputs better the comments are given inside a particular notation (.). When you are inputting get only appropriate values to the corresponding attributes and ignore the comments (.) section. In the similar way, while printing output please print the appropriate values of the corresponding attributes and ignore the comments (.) section.Sample Test cases:-case=oneinput=123 (Emp_ID)21 (Age)50000 (Salary)124 (Emp_ID)23 (Age)60000 (Salary)output=Employee 1Income tax=5000Educational chess=2500Professional tax=1500Total deductions=9000Annual salary without deductions=600000Annual salary with deductions=591000Employee 2Income tax=6000Educational chess=3000Professional tax=1800Total deductions=10800Annual salary without deductions=720000Annual salary with deductions=709200Highly paid is Employee 2Emp_ID=124Age=23Salary per month=60000Total deductions=10800Annual salary with deductions=709200grade reduction=15%case=twoinput=123 (Emp_ID)21 (Age)50000 (Salary)124 (Emp_ID)53 (Age)60000 (Salary)output=Invalidgrade reduction=15%case=threeinput=123 (Emp_ID)51 (Age)50000 (Salary)124 (Emp_ID)23 (Age)60000 (Salary)output= Invalidgrade reduction=15%case=fourinput=100 (Emp_ID)21 (Age)80000 (Salary)124 (Emp_ID)23 (Age)70000 (Salary)output= Employee 1Income tax=8000Educational chess=4000Professional tax=2400Total deductions=14400Annual salary without deductions=960000Annual salary with deductions=945600Employee 2Income tax=7000Educational chess=3500Professional tax=2100Total deductions=12600Annual salary without deductions=840000Annual salary with deductions=827400Highly paid is Employee 1Emp_ID=100Age=21Salary per month=80000Total deductions=14400Annual salary with deductions=945600grade reduction=15%