Write a program that calculates and displays the amount of money available in a bank account that initially has $8000 deposited in it and that earns interest at the rate of 3.5 percent a year. Your program should display the amount available at the end of each year for a period of 7 years. Use the relationship that the money available at the end of each year equals the amount of money in the account at the start of the year plus 0.035 times the amount available at the start of the year. We are currently using cin/cout, while loops, for loops
#include <iostream>
using namespace std;
int main()
{
int initial_amount=8000;
float rate=0.035;
for(int i=1;i<=7;i++)
{
//calculate the end of the year amount
float end_year_amount= initial_amount+(initial_amount*rate);
cout<<"year: "<<i<<"
"<<end_year_amount<<"$"<<endl;
initial_amount=end_year_amount;
}
}
Get Answers For Free
Most questions answered within 1 hours.