Question: c++ program 3. Write the C++ function salary O declared below. double salary(double sal, int grade, double &hra, double &carAllowance); that receives the basic salary

 c++ program 3. Write the C++ function salary O declared below.

c++ program

3. Write the C++ function salary O declared below. double salary(double sal, int grade, double &hra, double &carAllowance); that receives the basic salary (sal) of an employee and his/her grade (the integer 1 or 2) and returns the values of house rent allowance (hra) and carAllownce through reference variables. In addition, the function returns through return statement the total salary of an employee calculated using the following formula. Total salary- Base salary+hra Car Allowance, hra and carAllowance are computed as follows, If the grade is 1, then the HRA is 12% of the base salary and car allowance is 10% of the base salary . If the Grade is 2, then the HRA is 20% and the car allowance is 15% of the base salary entered Write a main program to test the salary function. Main should read base salary and grade from the user, call the function and print out hra, car allowance and total salary

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!