Answered step by step
Verified Expert Solution
Question
1 Approved Answer
need code in JAVA 1. Print a Retirement Forecast Table based on the information that the user will input. Prompt for the user's age, age
need code in JAVA
1. Print a Retirement Forecast Table based on the information that the user will input. Prompt for the user's age, age desired to retire, average expected rate, the initial, and the monthly contributions. The table will have 5 columns, for the Age, Year, interest Rate, Interest earned, and Accumulated value. In the following image is an example of what your output should look like (user input is in bold and underlined): Velcome to De Java. Vorking directory is V: Spring 20051083002 projects Project > tun Retireaent Forecast Spring 2000 - 051083 - Section OOX - Project 1 - Witten by TOUARE Retirement Forecast How old are you? 55 At what age would you like to retire? 65 What is the expected aretage rate of interest in .. 08 10 1000 What amount do you have now as initial contribution What would be your monthly contribution 250 - Petirezent Forecast Table Rate Interest Age Year Acculated 2020 2031 2033 2004 3035 2006 10.5000 10.5525 10. E580 10.7113 10.3900 10.4999 10.5483 10.5991 10.7051 10.7586 11.3965 6.651.99 3.1067.00 .1530.54 5.1976.73 .9545.55 6.3172.35 6.3876. 6.7938.4 6.13008.03 6.153.97 9.21513.70 4.27059.25 6.33239.10 6.40100.50 6.47799.00 4.56383.59 6.66383.30 2037 2008 2009 2030 6.5584.5 6.1899.75 Details The Console You will need to use Scanner to obtain input from the keyboard. You should declare a class constant of type Scanner named CONSOLE at the beginning of your class. You should store new Scanner(System.in) in CONSOLE. See examples in the Week 2 lecture notes of this website. Calculating Retirement Forecast When people start to think about a retirement plan there are several variables that can make a simple calculation somehow troublesome. Hence, showing a table to the user could help them understand how their retirement plan will behave. If the annual rate is r, the monthly rate is r/12. The annual rate is usually represented as a fraction, a number between 0 and 1, but the interest rate will be entered as a percentage. If the interest rate is 15%, 15 will be entered, and the rate will be 15/100 = .15. For this project a variable interest rate will be applied emulating a possible market fluctuation. The criteria for the variation of the interest rate applied is shown in the following table: Year multiple of Apply any other +0.5% If the balance at the beginning of the month is b and the monthly contribution is c, the interest i generated for that month will be calculated by (b + c) * r / 12. The balance at the end of that month will be ( b + c) + i . You will need to store what is the interest per year which is the one that is shown in the table. Make sure you understand this and can reproduce the first two lines of each of the above tables by hand with the help of a calculator. In writing your program, test it with the values shown above and make sure your program produces the correct values. Use the double data type for the balance, interest rate, monthly contribution, and yearly interest earned. Use CONSOLE.nextDouble() to read these in. Use the int data type for the age and retirement age variables and read them in using CONSOLE.nextInt(). Use tabs to line up the table entries. The values should be displayed with only two decimals and the different interest rates with 4 decimals. When you think your program is working correctly, run the program with the following input: Age: 35 Retirement age: 65 Average rate: 8.50 initial contribution: 100 monthly contribution: 400 Save the output to a file called Retirement ForecastOutput.txt in the project directory Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started