#include <iostream>
#include <string>
using namespace std;
int main()
{
// Variable declarations allowing us to calculate
string fullName;
int weeklySalary;
int weeks;
string age;
int option;
int actualage;
int earnings;
double savingsPercentage;
double percentage;
int retirementage;
double total;
cout << "What is your name? ";
getline(cin, fullName);
cout << "How old are you? ";
cin >> age;
cin.ignore(); // Removes the control character...
cout << "Please select an option: " << endl; // Main menu allowing selection of option.
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;
cin.ignore(); // Removes the control character...
do
{
if (option == 1)
cout << option << " ";
}
// The code in Case 1 calculates the Number of years you have.
cout << "You have " << actualage << " years until retirement." << endl;
cout << "Please select an option: " << endl; // Main menu allowing selection of option...
cin >> option;
cin.ignore(); // Removes the control character...
do
{
else if (option == 2)
{
cout << option << " ";
}
// The code in case 2 calculates the Amount Earned between now and retirement by age.
cout << "How much do you make per week in dollars? ";
cin >> weeklySalary;
cin.ignore(); // Removes the control character...
weeks = (52 * actualage);
earnings = (weeks * weeklySalary);
cout << "You will earn " "$"<< earnings << " between now and retirement." << endl;
cout << "Please select an option: " << endl; // Main menu allowing selection of option...
cin >> option;
cin.ignore(); // Removes the control character...
do
{
else if (option == 3)
cout << option << " ";
}
// The code in case 3 calculates the Amount Saved at Retirement taking into account the savings rate...
cout << "How much do you make per week in dollars? ";
cin >> weeklySalary;
cin.ignore(); // Removes the control character...
weeks = (52 * actualage);
earnings = (weeks * weeklySalary);
cout << "What percentage will you save? ";
cin >> savingsPercentage;
cin.ignore(); // Removes the control character...
percentage = (savingsPercentage / 100);
total = (percentage * earnings);
cout << "You will have " << total << " saved when you retire << endl;
cin >> option;
cin.ignore(); // Removes the control character...
do
{
else if (option == 4)
cout << option << " ";
}
cout << "Thanks for using our program." << endl;
}
"I am trying to use a Do While Loop per the requirements"