Loops and intrest

Task: Write a program to calculate how many years it will take for the money in your savings account to be worth $5,000.00 or more, if it pays 7.5% interest compounded annually. Use a loop structure in this program.

Formula: Total Amount = Amount + (Amount x Interest Rate)

Output: This program’s output should look exactly like:

It will take ____ years for the savings account to be worth $________.

In the above output, the first blank space is the number of years, and the last blank space is the total amount in the saving account after that number of years.


*Note I am really new to programming i don't know how to do this i got the first few bit, i need help fast.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
  /*  Program:    $5,000.00 or more
    Date:       12/14/13
    Description: This programs calculates when it will take for money to become $5,000.00 or greater.          */

#include <cstdlib>
#include <iostream>
#include <string>

using namespace std;

int main()
{
//  Declaration of Variables and Constants

   double totalAmount;
   double amount;
   const rate = 0.075;
closed account (G30GNwbp)
see:
http://www.cplusplus.com/doc/tutorial/control/#loops
Well, you haven't done anything yet. Try to think about algorithm(a list of operations that will solve problem).

Also, line 17:

 
const rate = 0.075


Has no type. Did you mean


 
const double rate = 0.075


Cheers!
Topic archived. No new replies allowed.