I need to do this but have no idea how: Future value problem Write a Java progra
ID: 3589295 • Letter: I
Question
I need to do this but have no idea how:
Future value problem Write a Java program named Futurevalue that does the following: 1. Asks the user for the amount used for opening a savings account. 2. Asks how much will be added to the account at the end of each year. 3. Asks the annual percentage rate the investment is expected to earn. 4. Asks how many years the user wishes to have forecast. Assume interest is compounded annually, meaning it is calculated on the account balance before the annual contribution by the user. Print a table showing the future value of the investment. This will have the following columns Year Beginning balance Interest earned • Annual addition • Ending balance (beginning balance plus interest earned plus annual addition) EXAMPLE: Opening amount: 1000 Annual additional payment: 100 Annual percentage growth: 6.5 Term: 25 years Year Begin Interest 1000.00 65.00 End Payment 100.00 1165.00 1340.73 1165.00 75.73 100.00 87.15 100.00 1527.87 1340.73 1527.87 99.31 100.00 1727.18 1727.18 100.00 1939.45 112.27 126.06 1939.45 2165.5 100.00 100.00 2165.5 140.76 2406.27 156.41 100.00 2406.27 662.68 2662.68 935.76 173.07 100.00 10 2935.76 190.82 100.00 3226.58 11 3226.58 09.73 100.00 3536.31 3866.17 12 3536.31 229.86 100.00 13 3866.17 251.30 100.00 4217.47 14 274.14 100.00 4217.47 4591.60 4591.60 4990.06 15 298.45 100.00 16 4990.06 324.35 100.00 5414.41 5866.35 17 351.94 100.00 5414.41 5866.35 18 381.31 100.00 6347.66 19 412.60 100.00 6347.66 6860 6860.26 7406.18 20 445.92 100.00 21 481.40 100.00 7987.58 7406.18 1987.58 519.19 100.00 8606 .77 559.44 100.00 9266.21 8606.77 9266 24 602.30 100.00 9968.51 25 9968.51 647.95 100.00 10716.47Explanation / Answer
import java.lang.*;
import java.util.*;
public class A
{
public static void main(String args[])
{
/* System.out.println("Hello");*/
Scanner obj=new Scanner(System.in);
System.out.println(" Enter Open Account Amount:");
double oa=obj.nextDouble();
System.out.println(" Annual Additional Payment:");
double aap=obj.nextDouble();
System.out.println(" Annual Percentage Growth:");
double apg=obj.nextDouble();
System.out.println(" Term:");
int t=obj.nextInt();
System.out.println(" Year Begin Interest Payment End");
for(int i=1;i<=t;i++)
{
double interest=(6.5/100)*oa;
double end=oa+interest+aap;
System.out.println(" "+Math.round(i)+" "+Math.round(oa*100.0)/100.0+" " +Math.round(interest*100.0)/100.0+" " +Math.round(aap*100.0)/100.0+" " +Math.round(end*100.0)/100.0);
oa=end;
}
/*System.out.println("The Value Is:"+a);*/
}
}
output:
C:UsersKranthiDesktop>javac A.java
C:UsersKranthiDesktop>java A
Enter Open Account Amount:
1000
Annual Additional Payment:
100
Annual Percentage Growth:
6.5
Term:
25
Year Begin Interest Payment End
1 1000.0 65.0 100.0 1165.0
2 1165.0 75.73 100.0 1340.73
3 1340.73 87.15 100.0 1527.87
4 1527.87 99.31 100.0 1727.18
5 1727.18 112.27 100.0 1939.45
6 1939.45 126.06 100.0 2165.52
7 2165.52 140.76 100.0 2406.27
8 2406.27 156.41 100.0 2662.68
9 2662.68 173.07 100.0 2935.76
10 2935.76 190.82 100.0 3226.58
11 3226.58 209.73 100.0 3536.31
12 3536.31 229.86 100.0 3866.17
13 3866.17 251.3 100.0 4217.47
14 4217.47 274.14 100.0 4591.6
15 4591.6 298.45 100.0 4990.06
16 4990.06 324.35 100.0 5414.41
17 5414.41 351.94 100.0 5866.35
18 5866.35 381.31 100.0 6347.66
19 6347.66 412.6 100.0 6860.26
20 6860.26 445.92 100.0 7406.18
21 7406.18 481.4 100.0 7987.58
22 7987.58 519.19 100.0 8606.77
23 8606.77 559.44 100.0 9266.21
24 9266.21 602.3 100.0 9968.51
25 9968.51 647.95 100.0 10716.47
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.