/************************************************
FINANCIAL SIMULATION
You have a bank account whose annual interest
rate depends on the amount of money you have
in your account at the beginning of each year.
Your annual rate starts at 3%, and grows by an
additional half a percent for each thousand
dollars in your account up to, but not exceeding
8%. Interest in this account is compounded monthly
at the annual rate. Each year you also make a
deposit (before the bank figures out what your
rate is, fortunately). Write a program that
simulates these financial interactions. It
should first ask the user how many years he
wants to simulate, and at the beginning of each
year it should ask the user how much he wants to
deposit.
***************************************************/#include <iostream>usingnamespacestd;intmain(){//Get number of yearsintY;cout<<"How many years would you like to simulate: ";cin>>Y;/*************************************************//******** S I M U L A T E Y Y E A R S ********//*************************************************/doubleB=0;for(intk=0;k<Y;k++){//Get payment amount & adjust balancedoubleP;cout<<"Payment for year "<<k+1<<" : ";cin>>P;B=B+P;//Compute annual rate RintT=B / 1000;//Get number of 1000'sdoubleR=3+0.5*T;//Compute rateif(R>8.0)//Correct for 8% capR=8.0;//Compute new balance with interest for the yeardoubler=R/100;for(inti=0;i<12;i++)B=B*(1+r/12);}//Print final balancecout<<"Final balance is "<<B<<" dollars"<<endl;return0;}