Workers at a particular company were given a 15.5% salary increase. Moreover, the increase was retroactive for 2 months, that is effective two months ago. Write a C++ program that takes the employee’s old salary as input and then output the amount of retroactive pay (balance) due to the employee and his new salary as well.
Expert Answer
C++ Program:
#include <iostream>
#include <iomanip>
using namespace std;
//Constant declaration
const double HIKE = 15.5;
//Main function
int main()
{
double oldSalary, newSalary, retroActivePay;
//Reading old salary
cout << “nn Input employee old salary: $”;
cin >> oldSalary;
//Calculating new Salary
newSalary = oldSalary + (oldSalary * (HIKE/100.0));
//Calculating retroactive pay for 2 months
retroActivePay = (newSalary – oldSalary) * 2;
cout << fixed << setprecision(2);
//Printing calculated values
cout << “nn Amount of retroactive pay (balance) due to employee: $” << retroActivePay;
cout << “nn New Salary: $” << newSalary << ” nn”;
return 0;
}
____________________________________________________________________________________________
Sample Output: