Question: I need the answer in Java format 3. (21 points) Write a method that calculates and returns the value of an investment after a number
3. (21 points) Write a method that calculates and returns the value of an investment after a number of years, assuming that interest is compounded only at the end of each year. Your method will need the following parameters: The initial amount of money invested The interest rate The number of years you will be holding the investment You can use the formula value = investment * (1 + rate)years . You must include a Javadoc comment Name CSCI161-(01,02,03 Homework 03- Page 2 4. (19 points) Write a main method that would go in the same class as the previous method. It should read an initial investment amount and interest rate from the user. Then it should print a two-column table showing the number of years and final value for each year from 1-20. You do not need to include Javadoc comments. You may assume that the Scanner class has already been imported
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
