C++ Programming assignment. - suppose you deposit $50 per month in a bank accoun
ID: 3676240 • Letter: C
Question
C++ Programming assignment.
- suppose you deposit $50 per month in a bank account every month for a year. Every month, after the deposit has been made, interest at the rate of 1 percent is added to the balance, e.g. after one month, the balance is $50.50, and after two months it is $101.51. Write a C++ program to compute and print the balance each month for a year. Arrange the output to look something like this: (hint: use a for loop)
MONTH MONTH-END BALANCE
1 50.50
2 101.51
3 153.02
...
12 640.47
Explanation / Answer
#include <iostream>
int main()
{
double principal, interest_rate, balance, interest;
int month, total_months;
cout << Enter a Current Balance/principal amount in your account: $ ";
cin >> principal;
cout << Enter the interest rate: ";
cin >> interest_rate;
interest_rate /= 100;
total_months = 12 ;
balance = principal;
for ( month = 0; months < total_months; ++month )
{
interest = balance * interest_rate;
balance += interest;
cout << "After month " << month << ", your Month-End balance is : $" << balance <<
endl;
}
return 0;
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.