'''calculate the future value of an investment after 10 years'''
def calcValue( initialValue, interestRate ):
period = 10
investmentValue = initialValue
for i in range(period):
investmentValue = investmentValue * ( 1 + interestRate )
principal = int(raw_input("Enter initial investment amount: "))
interest = float(raw_input("Enter interest rate as a percentage: ")) / 100
finalValue = calcValue( principal, interest )
print "Final value of the investment is $%0.2f" % finalValue
Modify the function so that the user can specify the period of the investment. Further modify the function so that the user can make additional fixed yearly investments.
Specify 5 sets of test data you can use to test the program and the expected results for that test data. Provide test listings to verify your predictions.
Recently Asked Questions
- The following double integral cannot be solved as written. Reverse the order of integration to create a solvable equivalent intergal, and then solve it. Double
- Use a triple integral to find the volume of the region in between inverted cone whose equation is z = 2 − sqrt(x^2+y^2) , and the plane z = 0.
- If z(x, y) = e^( x^2 y) , with x = r cos θ and y = r sin θ, find the values of ∂z/∂r and ∂z/∂θ when r = 2 and θ = π/4.