Hey guys. I'm a newbie and this is my assignment for a class day after tomorrow. Since I'm new to this I made the program but the problem is the answer has to be in this form:
Initial deposit? 10000
Interest rate? 1.2
Number of years? 9
Balances at the end of each year:
Beginning Ending
Year Balance Interest Balance
1 10000.00 110.00 10110.00
2 10110.00 111.21 10221.21
3 10221.21 112.43 10333.64
4 10333.64 113.67 10447.31
5 10447.31 114.92 10562.23
6 10562.23 116.18 10678.42
7 10678.42 117.46 10795.88
8 10795.88 118.75 10914.64
9 10914.64 120.06 11034.70
10 11034.70 121.38 11156.08
But since we haven't covered the topic on how to print it out in tables it's not necessary. All I have to display is how it is added to each year and is shown at the year end balance.
Here's my code:
Thanks guys.
Initial deposit? 10000
Interest rate? 1.2
Number of years? 9
Balances at the end of each year:
Beginning Ending
Year Balance Interest Balance
1 10000.00 110.00 10110.00
2 10110.00 111.21 10221.21
3 10221.21 112.43 10333.64
4 10333.64 113.67 10447.31
5 10447.31 114.92 10562.23
6 10562.23 116.18 10678.42
7 10678.42 117.46 10795.88
8 10795.88 118.75 10914.64
9 10914.64 120.06 11034.70
10 11034.70 121.38 11156.08
But since we haven't covered the topic on how to print it out in tables it's not necessary. All I have to display is how it is added to each year and is shown at the year end balance.
Here's my code:
Code:
#include<iostream>
#include<iomanip>
using namespace std;
int main(){
double money = 0.0;
double interest = 0.0;
int year = 0;
int total = 0;
cout << "Initial deposit: " << endl;
cin >> money;
cout << "Annual interest rate: " << endl;
cin >> interest;
cout << "Number Of Years: " << endl;
cin >> year;
do
{
money += (money*(interest / 100));
total++;
}
while (total<year);
cout << money << endl;
system("pause");
}
Comment