Question: In java Suppose you want to deposit a certain amount of money into a savings account and then leave it alone for the next 10
In java
Suppose you want to deposit a certain amount of money into a savings account and then leave it alone for the next 10 years. At the end of 10 years you would like to have $10,000 in the account. How much do you need to deposit today to make that happen? You can use the following formula to find out:
P = F/(1+r) ** n Where P is the present Value F is the future Value R is the annual interest rate(for e.g. 0.05) N is the number of years it will be in the bank
Write a method presentValue that performs the above calculation. The method should accept future Value, annual interest rate, number of years as arguments. It should return present value, which is the amount needed to deposit today.
In the main method try to get the present value for 5 different future values keeping the rate and number of years same
Output What is annual interest rate? .05 For how many years? 10 What is the desired future value? 10000 You need to invest $6,139.13 What is the desired future value? 15000 You need to invest $9,208.70 What is the desired future value? 20000 You need to invest $12,278.27 What is the desired future value? 18000 You need to invest $11,050.44 What is the desired future value? 25000 You need to invest $15,347.83
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
