Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
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