Programming Exercise 8 |
< Previous Next > |
Suppose you have a certain amount of money in a savings account that earns compound monthly interest, and you want to calculate the amount that you will have after a specific number of months. The formula is as follows: f = p * (1 + i/12)t
Write a program that takes the account's present value, monthly interest rate, and the number of months that the money will be left in the account as three inputs from the user. The program should pass these values to a function that returns the future value of the account, after the specified number of months. The program should print the account's future value.
Please enter the current value: 100 You entered $100.00 Please enter the annual interest rate: 0.0075 You entered 0.0075 (which is 0.75%) Please enter the number of months: 12 You entered 12 months In 12 months, the value of the account will be $100.75
Please enter the current value: 15000 You entered $15,000.00 Please enter the annual interest rate: 0.0274 You entered 0.0274 (which is 2.74%) Please enter the number of months: 60 You entered 60 months In 60 months, the value of the account will be $17,199.74
Please enter the current value: 250000.00 You entered $250,000.00 Please enter the annual interest rate: 0.035 You entered 0.035 (which is 3.5000000000000004%) Please enter the number of months: 360 You entered 360 months In 360 months, the value of the account will be $713,321.79
handin pe8 pe8.pyTo verify your submission, type the following in a terminal window:
handin pe8