In: Computer Science
Using Visual Studio C Language.
Problem 1
Workers at a particular company have won a 7.6% pay increase retroactive for 6 months. Write a program that takes an employee's previous annual salary as input and outputs the amount of retroactive pay due to the employee, the new annual salary and the new monthly salary. Use a variable declaration with the modifierconst to express the pay increase. Your program should allow the calculation to be repeated as often as the user wishes.
Retroactive - taking effect from a date in the past
Sample output as follows:-
Enter current annual salary:100000
Program should return new annual salary, monthly salary, and retroactive pay.
new annual salary 107600
new monthly salary 8966.67
retroactive salary due: 3800
Use Visual studio 2010 C++ to run this program:
#include
using namespace std;
//pay increase retroactive per months
const double INCREASE=1.23;
//Function prototype
void calculate(double previous_salary,int months)
{
double new_salary, pay_raise;
pay_raise=((previous_salary/100)*INCREASE)/months;
new_salary = previous_salary+(pay_raise*months);
cout << "Your new yearly salary is " << new_salary<< " dollars for this year.\n";
}
int main( )
{
//pay increase retrper 6 months
const double PAY_INCREASE = 7.6;
double previous_salary;
double new_salary, pay_raise;
int months;
cout << "Enter employee's previous annual salary:\n";
cin >> previous_salary;
cout<<"Enter number of months to calculate the new
salary:"< cin>>months; calculate(previous_salary,months); system("pause"); return 0; }