Using a given interest rate, balance, and term output a table of adjusted balances each year for the number of years specified by the term. For this assignment you will use a simplified formula:
interest = balance * rate / 100.0;
Basically you want to add the interest to the balance each year.
This assignment must be done using a for loop to calculate the table.
You can output fixed width using the following:
setw(int n) -- sets the field width
fixed -- sets fixed length
setprecision(int n) -- sets decimal place
You must also include <iomanip> in order to set the precision.
Input: interst rate (like 5.0), balance, term
Process: Compute a running balance
Output: Table of adjusted balances
------ I'VE BUILT THE CODE SO FAR; BUT I'M HAVING A HARD TIME UNDERSTANDING IT, BY OUTPUTTING A TABLE.
--------------------------------------------------------------------------
#include<iostream>
#include<iomanip>
using namespace std;
int main ()
{
double money=0.0;
double interest=0.0;
int year=0;
int C=0;
cout<<"Enter an amount to invest"<<endl;
cin>>money;
cout<<"Enter an annual interest rate"<<endl;
cin>>interest;
cout<<"Enter how many years you want calculated"<<endl;
cin>>year;
do
{
money+=(money*(interest/100));
C++;
}
while (C<year);