Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Spring 2020 - CS1083 - Seclion cox - Project 1 - wrillen by YOURNAME Note that YOURNAME and 00X should be replaced. The program will
Spring 2020 - CS1083 - Seclion cox - Project 1 - wrillen by YOURNAME Note that YOURNAME and 00X should be replaced. The program will also perform the following process: 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): Welcome to DrJava. Vorking directory is V: Spring2020CS1083002 projects Project > run Retirement Forecast Spring 2020 - CS1083 - Section OOX - Project 1 - written by YOURNAME Retirement Forecast How old are you? 55 At what age would you like to retire? 65 What is the expected average rate of interest in: (e.g. 8%)? 10 What amount do you have now as initial contribution? 1000 What would be your monthly contribution? 250 ----- Retirement Forecast Table Rate Interest Age Year Accumulated 2020 2021 2022 2023 2024 2025 10.5000 10.5525 10.6580 10.7113 10.3900 10.4939 10.5463 10.5991 10.7051 10.7586 11.2965 $.286.42 $.651.99 $. 1067.62 $. 1530.94 $.1976.73 $.2545.55 $.3172.85 $.3876.48 $. 4690.49 $.5584.52 6.6899.79 $.4286.42 $.7938.41 $.12006.03 $.16536.97 $. 21513.70 $.27059.25 $.33232.10 $. 40108.58 $.47799.07 $.56383.59 4.66283.38 2026 2027 2028 2029 2030 WWW.CS utsa edu/CS1083roiects/Snring 2020/Proiect1/2020205 outnut na 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 10 +5% +1% any other +0.50 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 RetirementForecastOutput.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