36.1k views
3 votes
Financial application: calculate future investment value)

Write a program that reads in an investment amount, the annual interest rate, and the number of years, and then displays the future investment value using the following formula:

futureInvestmentAmount = investmentAmount * (1 + monthlyInterestRate) ^ numberOfMonths

For example, if you enter the amount 1000.56, an annual interest rate of 4.25%, and the number of years as 1, the future investment value is 1043.33. Here is a sample run:

Enter investment amount: 1000.56

Enter annual interest rate: 4.25

Enter number of years: 1

Accumulated value is 1043.92.

In Python.

1 Answer

2 votes

Answer:

Using Python

python code:

investmentAmount=float(input("Enter investment amount: "))

annualInterestRate=float(input("Enter annual interest rate: "))

numberOfYears=int(input("Enter no. of years: "))

futureInvestmentAmount=investmentAmount*((1+(annualInterestRate/1200))**(numberOfYears*12))

#formula defined

print ("Accumulated value: ",round(futureInvestmentAmount,2))

output

Enter investment amount: 1000.56

Enter annual interest rate: 4.25

Enter number of years: 1

Accumulated value is 1043.92