In my Computer science class we need to create a program that looks like this.
http://pho.to/4esUH
I am confused as to why the interest rate raises 0.02 then raises 0.01 and back to raising 0.02? How can I set this interval ?
Also can you assist me in how to find the total interest rate added (book page/website ok)
*Sorry about the bad formatting, I am new...*
_________________________________________
#include <iostream>
#include <cmath>
#include <iomanip>
#include <string>
#include <ctime>
using namespace std;
int main()
{
cout << "Accumulate interest on a savings account. \n";
cout << "Starting value is $100 and interest rate is 1.25%" << endl << endl;
int year = 1;
double interest = 1.25;
double total = 100.00;
double tot;
cout << fixed << showpoint << setprecision(2);
while (year <= 10)
{
total = total + interest;
cout << "Year " << year << " adds " << interest << " for a total of " << total << ".\n";
year = year + 1;
interest = interest + 0.02;
}
tot = interest + interest;
cout << "\n" << "Total Interest credited was " << tot << ".\n" << endl;
cout << "Completed Part 4." << endl << endl;
system("pause");
return 0;
}
_____________________________________________________________
I need this by tomorrow morning... Please Help~