For this problem you will be calculating the amount of money

For this problem you will be calculating the amount of money you will have at retirement if you invest a fixed amount every month. Specifications 1. Requirements 1. You must use loops to solve this problem 2. You must have at least one function 2. Input 1. The user\'s current age 2. The age the user wants to retire at 3. How much money the user will invest towards savings each month 4. Expected average annual interest rate 1. Since we are assuming that interest is compounded monthly for this problem you will want to use 1 12 this value in your calculations 3. Output 1. At the end of each year you should output how much the user will have in savings 4. Assumptions 1. Interest is applied at the beginning of each month before your monthly invest is added in.

Solution

#include <iostream>
#include <iomanip>
using namespace std;
int AcceptAge()
{
   int curr,retire;
   cout<<\"Enter age\ \";
   cin>>curr;
   cout<<\"Enter Retirement age\ \";
   cin>>retire;
   return (retire-curr)*12;


}
int main()
{

int no=1;
  

  
float saving = 1;
  
do
{
cout<< \" How much money will you saving/month? \";
cin>> saving;
}
while( saving <= 0);

  
float IRate = 1;
do
{
cout<< \" Enter IRate rate \";
cin>> IRate;
}
while( (IRate < 0) || (IRate > 100));


float totalMonths = AcceptAge();

float target = 1;
do
{
cout<< \" What is your savings target? \";
cin>> target;
}
while(target <= 0);

  

cout<< setprecision(0) << fixed << \"totalMonths\\tdep.this month\\ttotal deposited\\ttotal savingd\ \";
int i=0;
int y=1;
while(no <= totalMonths)
{
       if(i%12==0)
       {
           cout<<\"Year \"<<y<<endl;
           y++;
       }
cout<< no++;
cout<< \"\\t\"<<saving;
cout<<\"\\t\"<<saving++<<endl;
i++;
}


}

=======================================================

akshay@akshay-Inspiron-3537:~/Chegg$ g++ loan.cpp
akshay@akshay-Inspiron-3537:~/Chegg$ ./a.out
How much money will you saving/month? 1200
Enter IRate rate 10
Enter age
25
Enter Retirement age
28
What is your savings target? 1200000
totalMonths   dep.this month   total deposited   total savingd
Year 1
1   1200   1200
2   1201   1201
3   1202   1202
4   1203   1203
5   1204   1204
6   1205   1205
7   1206   1206
8   1207   1207
9   1208   1208
10   1209   1209
11   1210   1210
12   1211   1211
Year 2
13   1212   1212
14   1213   1213
15   1214   1214
16   1215   1215
17   1216   1216
18   1217   1217
19   1218   1218
20   1219   1219
21   1220   1220
22   1221   1221
23   1222   1222
24   1223   1223
Year 3
25   1224   1224
26   1225   1225
27   1226   1226
28   1227   1227
29   1228   1228
30   1229   1229
31   1230   1230
32   1231   1231
33   1232   1232
34   1233   1233
35   1234   1234
36   1235   1235

For this problem you will be calculating the amount of money you will have at retirement if you invest a fixed amount every month. Specifications 1. Requirement
For this problem you will be calculating the amount of money you will have at retirement if you invest a fixed amount every month. Specifications 1. Requirement
For this problem you will be calculating the amount of money you will have at retirement if you invest a fixed amount every month. Specifications 1. Requirement

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site