1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99
|
/*
Lab06_pensionplans.cpp
Purpose :
- Create a simple financial application to calculate retirement plans
*/
#include <iostream>
#include <cstdlib>
using namespace std;
void displayMenu()
{
system("cls");
cout << "+-------------------------------------+" << endl;
cout << "| Golden Years Financial Inc. |" << endl;
cout << "|=====================================|" << endl;
cout << "| Select: |" << endl;
cout << "| 1 => Display Data |" << endl;
cout << "| 2 => Change Data |" << endl;
cout << "|-------------------------------------|" << endl;
cout << "| 3 => One Lump Sum Withdrawal Plan |" << endl;
cout << "| 4 => Yearly Withdrawal Plan |" << endl;
cout << "| 5 => Comparison of Both Plans |" << endl;
cout << "|-------------------------------------|" << endl;
cout << "| Q => Quit |" << endl;
cout << "+-------------------------------------+" << endl;
cout << endl;
cout << "Choice => ";
}
/*#1*/ void displayData(int startingAge, int numOfYears,
double lumpSumAmount, double yearlyAmount,
double interestRate )
{
cout << endl;
cout << "Starting Age = " << startingAge << endl;
cout << "Nunber of Years = " << numOfYears << endl;
cout << "Lump Sum Amount = " << lumpSumAmount << endl;
cout << "Yearly Amount = " << yearlyAmount << endl;
cout << "Interest Rate (%) = " << interestRate << endl;
cout << endl;
system("pause");
}
/*#2*/ void changeData(int startingAge, int numOfYears,
double lumpSumAmount, double yearlyAmount,
double interestRate )
{
cout << endl;
cout << "Starting Age = ";
cin >> startingAge;
cout << "Nunber of Years = ";
cin >> numOfYears;
cout << "Lump Sum Amount = ";
cin >> lumpSumAmount;
cout << "Yearly Amount = ";
cin >> yearlyAmount;
cout << "Interest Rate (%) = ";
cin >> interestRate;
}
int main()
{
int startingAge = 55;
int numOfYears = 20;
double lumpSumAmount = 400000;
double yearlyAmount = 25000;
double interestRate = 5;
char choice;
bool done = false;
do
{
displayMenu();
cin >> choice;
choice = toupper(choice);
switch (choice)
{
case '1' : displayData(startingAge, numOfYears,
lumpSumAmount, yearlyAmount, interestRate);
break;
case '2' : changeData(startingAge, numOfYears,
lumpSumAmount, yearlyAmount, interestRate );
system("pause");
break;
case '3' : cout << "Not yet implement" << endl;
system("pause");
break;
case '4' : cout << "Not yet implement" << endl;
system("pause");
break;
case '5' : cout << "Not yet implement" << endl;
system("pause");
break;
case 'Q' : done = true;
break;
default : cout << "Invalid selection, try again!" << endl;
system("pause");
break;
}
} while (!done);
cout << "Good Bye!" << endl;
cout << endl;
}
|