Question: 4 . In the main method, right below the code you wrote for step 3 , write the code to find the investment value for
In the main method, right below the code you wrote for step write the code to find the
investment value for each year and the total interested earned on an initial investment of
$ Your rate of returns for years are as follows:
Year return is
Year return is
Year return is
Year return is
Create the following variables and complete the code based on the information given.
Hint: totalInterestEarned is the total amount of money youve gained after the years of
investing, so it should be calculated last.
double initialInvestment
double yearInterestRate
double yearInterestRate
double yearInterestRate
double yearInterestRate
double totalInterestEarned
Use a simple interest formula to calculate the investment values for each year.
double yearInvestmentValue ;
double yearInvestmentValue
double yearInvestmentValue...
double yearInvestmentValue
Calculate your investment value after each year and output the following:
NOTE: First use println to output the values once, then use printf to output them again with
the right formatters. All your output must align to get full credit.
Remember to call printStepHeader with the right input to output the header.
Output for this StepYours should match exactly:
Step:
USING PRINTLN
initialInvestment:
yearInvestmentValue:
yearInvestmentValue:
yearInvestmentValue:
yearInvestmentValue:
totalInterestEarned:
USING PRINTF with format right justified, min places, decimal places
initialInvestment:
yearInvestmentValue:
yearInvestmentValue:
yearInvestmentValue:
yearInvestmentValue:
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
