Ok, I am trying to work through this program and it is stopping at asking me what is my current salary. The problem is this:
Starting January 1st, of each year for three years, I will be getting a raise of .05 on my previous years salary. I wasnt a program that calculates and displays the amount of salary of $10,000 ( The raise amounts are $500.00, $525.00, $ 551.25. The total salary is $33,101.25)
Below is what I have got. I have to do this problem with a while statement.
#include <iostream>
#include <iomanip>
using namespace std;
int main()
{
//declare variables
int year3 = 0;
int year2 = 0;
int year1 = 0;
double current_salary = 0.0;
double raise = 0.0;
double totalSalary = 0.0;
const double rate = 1.05;
//Enter Salary
cout << "Enter Annual Salary: $ " ;
cin >> current_salary;
while ((year1 < 4 && year1 > 0) (year2 = 1 && year2 < 4) (year3 > 0 && year3 < 4));
{
year1 = current_salary * raise;
year2 = year1 * raise;
year3 = year2 * raise;
current_salary = year1 + year2 + year3;
totalSalary += current_salary;
} //end while
cout << "Raise for year 1:$ " << year1 << endl;
cout << "Raise for year 2:$ " << year2 << endl;
cout << "Raise for year 3:$ " << year3 << endl;
cout << fixed << setprecision(2);
cout << "Total salary for the three years:$ " << totalSalary << endl;
system("pause");
return 0;
} //end of main function
Would someone please help me with this?
Thank you in advance.