The Tradition of Sharing

Help your friends and juniors by posting answers to the questions that you know. Also post questions that are not available.

To start with, Sr2Jr’s first step is to reduce the expenses related to education. To achieve this goal Sr2Jr organized the textbook’s question and answers. Sr2Jr is community based and need your support to fill the question and answers. The question and answers posted will be available free of cost to all.


Walter Savitch ,kenrick Mock
C++ Basics
Programming Projects
Question:3 | ISBN:9780132846813 | Edition: 5


Workers at a particular company have won a 7.6% pay increase retroactive for six 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 const to express the pay increase.



#include <iostream> 
using namespace std; 
int main() 
double oldSalary, retroSalary, newSalary, increaseSalary, newMonthlySalary; 
const double payIncrease = .076; 
cout << "Enter your old annual salary." << endl; 
cin >> oldSalary; 
 newSalary = (oldSalary * .076) + oldSalary; 
increaseSalary = newSalary - oldSalary; 
newMonthlySalary = newSalary / 12; 
retroSalary = (oldSalary / 2) * payIncrease; 
 cout << endl; 
cout << "Your new annual salary is: $" << newSalary << endl; 
cout << "You received a $" << increaseSalary << " increase in salary." << endl; 
cout << "You will receive $" << retroSalary << " in retroactive salary." << endl; 
cout << "Your new monthly salary is: $" << newMonthlySalary << endl; 
 return 0; 


0 0


Post the discussion to improve the above solution.