1.Workers at a particular company have won a 7.6% pay increase retroactive for 6
ID: 3628374 • Letter: 1
Question
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 the employee,the new annual salary,and the new monthly salary.Use a variable declaration with the modifier constant to express the pay increase.Your program should allow the calculation to be repeated as often as the user wishes.2.Modify your programming project 2 above so that it calculates the retroactive salary for a worker for any number of months,instead of just 6 months.The number of months is entered by the user.
Explanation / Answer
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. ";
}
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: ";
cin >> previous_salary;
cout<<"Enter number of months to calculate the new salary:"<<endl;
cin>>months;
calculate(previous_salary,months);
system("pause");
return 0;
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.