Compound Interest

Introduction

How much money will you have after investing it for several years?

Design

  1. All input and output data is in percents, dollars, and years
  2. Interest is calculated annually at the end of the year
  3. Ask the user for:
    • Annual Interest rate (percent)
    • Initial investment amount (dollars)
    • Years of investment (years)
  4. Display the total amount of the investment at the end of investment years

Calculation

Input

Ai      // initial investment amount (dollars)
R       // annual interest rate (percent converted to decimal)
Y       // length of investment (years)
N       // number of times the interest is compounded per year
Final amount
Af = Ai * (1 + R/N)YN

Note: Go here for more information on the calculation

Try This

a. Show the accumulated amount for each year.

b. Invest an additional amount at the beginning of each year.

c. In 1626 Peter Minuit bought Manhattan island from the local Indians for a load of cloth, beads, hatchets, and other odds and ends then worth 60 Dutch guilders ($24 dollars). If the money ($24) was invested in 1626 at 5% interest per year, what would the investment be worth today?