View the step-by-step solution to:

# Here is a program that calculates the final value of a 10 year fixed term investment, given the initial investment amount and the interest rate.

Here is a program that calculates the final value of a 10 year fixed term investment, given the initial investment amount and the interest rate.
'''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 )

return investmentValue

def main():
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

main()
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.

### Why Join Course Hero?

Course Hero has all the homework and study help you need to succeed! We’ve got course-specific notes, study guides, and practice tests along with expert tutors.

### -

Educational Resources
• ### -

Study Documents

Find the best study resources around, tagged to your specific courses. Share your own to gain free Course Hero access.

Browse Documents