##Student Name: Wurong Weng
##MacID: wengwr
##Student Number: 1224989
##Lab Section: L16
##Date: Jan. 23, 2013

import math

p = input("Enter the initial principle: ")
r = input("Enter the interest rate: ")
n = input("Enter the number of times the interest is compounded per year: ")
t = input("Enter the time expressed as a number: ")
print

A1 = p*(1+r/n)**(n*t)
print "The future value with compound interest is A1=", A1
print

A2 = p
for i in range(1, n*t+1):
    A2 = A2*(1+r/n)
    print "The future value with compound interesr is A2=", A2
print

B = p * math.exp(r*t)
print "The future value withh continuous compound interest is B=",B
print

d1 = 100 * abs(A1 - A2) / A1
print "The relative difference between compound interest values is d1=",d1

d2 = 100 * abs(A1 - B) / B
print "The relative difference between compound and continuous compound interest values is d2=",d2

## Design Question
## No, our program does not enforce n and t to be integers because both integers and
## float work fine with our mathmatical process, but if the user enter the float for
## n or t, the loop part will not work since the range() function can only contain integers.

## Test Plan
## Test 1
## Input: [100, 0.5, 4, 5]
## Expected Output: [1054.51, 1054.51, 1218.25, 0.0, 13.44]
## Actual Output: [1054.51, 1054.51, 1218.25, 0.0, 13.44]

## Test 2
## Input: [100, 0, 4, 5]
## Expected Output: [100, 100, 100, 0.0, 0.0]
## Actual Output: [100, 100, 100, 0.0, 0.0]
