Need Help solving this. No Clue
Mar 14, 2013 at 12:13am UTC
Suppose you start with 100 dollars in your account and every year it becomes 1.04 times what you had last year (because there is 4% interest). Write a program that tells you how much money you will have in your account for each of the next 25 years.
Mar 14, 2013 at 12:23am UTC
Mar 14, 2013 at 12:32am UTC
Here you go, very easy:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56
//
//The program to evaluate simple interest
//
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <string>
using namespace std;
int main(int nNumberofArgs, char * pszArgs[])
{
double total;
//Enter the factor
double principle;
cout << "Enter the amount of money that is in the bank:" << endl;
cin >> principle;
//Enter the principle
double time;
cout << "Enter the amount of time your money is in the bank (Months):" << endl;
cin >> time;
time = time / 12;
//enter the rate
double rate;
cout << "Enter the interest rate:" << endl;
cin >> rate;
//the math for monthly interest
cout << "Starting month: $" << principle << endl;
int row = 1;
double principle2 = principle;
for (int time1 = 1;time1 <= time;time1++)
{
double pre_total;
pre_total = principle2 * rate;
principle2 = principle2 + pre_total;
total = principle2;
cout << "Year " << row << " - $" << total << endl;
row++;
}
double intgained = principle2 - principle;
//show results
cout << "Here is interest gained: $" << intgained << endl;
cout << "Here is your accumulated money after " << time << " years: $" << total << endl;
//wait before terminating
system ("PAUSE" );
return 0;
}
Topic archived. No new replies allowed.