Calculate the number of years


Calculate the number of years between now and retirement and calcualte the amount of money you will make betwen now and retirement, calculate the amount of money you will save between now an d retirement
#include
#include
using namespace std;
int main()
{
string name;
int age, option = 3, salary, retireDif, retireAge, totalEarned;
double totalSaved, savingsRate;

cout << "What is your name? ";
getline(cin, name);

cout << "How old are you? ";
cin >> age;
if (age >= 60)
{
retireAge = 65;
}

if ((age >= 50) && (age < 60))
{
retireAge = 67;
}

if ((age >= 40) && (age < 50)) 
{
retireAge = 70;
}

if (age < 40)
{
retireAge = 72;
}
retireDif = retireAge - age;
while (option != 4) 
{

cout << "Please select an option: " << endl;
cout << "t (1) Number of years to retirement" << endl;
cout << "t (2) Amount earned between now and retirement" << endl;
cout << "t (3) Amount saved at retirement" << endl;
cout << "t (4) Exit (do nothing)" << endl;
cin >> option;
switch(option)
{
case 1:
cout << "You have " << retireDif << " years until retirement." << endl;
cout << endl;
break;
case 2:
cout << "How much do you make per week in dollars? ";
cin >> salary;
totalEarned = salary * 52 * retireDif;
cout << "You will earn $" << totalEarned << " between now and retirement." << endl;
cout << endl;
break;
case 3:
cout << "How much do you make per week in dollars? ";
cin >> salary;
totalEarned = salary * 52 * retireDif;
cout << "What percentage will you save? ";
cin >> savingsRate;
totalSaved = (totalEarned * savingsRate) / 100;
cout << "You will have " << totalSaved << " saved when you retire." << endl;
cout << endl;
break;
case 4:
cout << endl;
cout << endl;
cout << "Thanks for using our program!" << endl;
break;
default:
cout << "Please choose a valid option." << endl;
cout << endl;
break;
}

}
}

Request for Solution File

Ask an Expert for Answer!!
Programming Languages: Calculate the number of years
Reference No:- TGS0123913

Expected delivery within 24 Hours