Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

totalInterestEarned = year 4 InvestmentValue - initialInvestment; / / Output using println printStepHeader ( 4 ) ; System.out.println ( initialInvestment: + initialInvestment )

totalInterestEarned = year4InvestmentValue - initialInvestment;
// Output using println
printStepHeader(4);
System.out.println("initialInvestment: "+ initialInvestment);
System.out.println("year1InvestmentValue: "+ year1InvestmentValue);
System.out.println("year2InvestmentValue: "+ year2InvestmentValue);
System.out.println("year3InvestmentValue: "+ year3InvestmentValue);
System.out.println("year4InvestmentValue: "+ year4InvestmentValue);
System.out.println("totalInterestEarned: "+ totalInterestEarned);
// Output using printf
System.out.printf("initialInvestment: %.2f%n", initialInvestment);
System.out.printf("year1InvestmentValue: %.2f%n", year1InvestmentValue);
System.out.printf("year2InvestmentValue: %.2f%n", year2InvestmentValue);
System.out.printf("year3InvestmentValue: %.2f%n", year3InvestmentValue);
System.out.printf("year4InvestmentValue: %.2f%n", year4InvestmentValue);
System.out.printf("totalInterestEarned: %.2f%n", totalInterestEarned);

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Essential SQLAlchemy Mapping Python To Databases

Authors: Myers, Jason Myers

2nd Edition

1491916567, 9781491916568

Students also viewed these Databases questions