Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Format the following code using Java printf instead of println to look like the attached image. public void printStatement() { double localBalance = mOpeningBalance; System.out.println(Description
Format the following code using Java printf instead of println to look like the attached image.
public void printStatement() {
double localBalance = mOpeningBalance;
System.out.println("Description / Balance");
System.out.println("==================");
System.out.println("Opening balance" + mOpeningBalance);
Collections.sort(mTxns);
for (Transaction tran : mTxns) {
localBalance += tran.getAmount();
System.out.println(tran);
System.out.println(localBalance);
}
System.out.println("Closing balance " + localBalance);
}
}
I just need println changed to printf in order to justify the output correctly. No need to compile or prove any code, just provide the printf statements given my working code block in plain text.
Balance Description Opening balance Debit on 10/7/16 for $23.50 to "Gas - Exxon" Deposit on 11/1/16 for $2759.35 (Direct deposit ABC Company payroll) Check #500 on 11/5/16 for $132.75 to "Student loan" memo: Check #501 on 11/15/16 for $1576.32 to "Mortgage" memo: December payment Debit on 11/25/16 for $46.75 to "CVS Store #103" Debit on 12/15/16 for $15.23 to "Starbucks, Madison" Check #502 on 12/25/16 for $400.25 to "Holiday presents" memo: for the kids Deposit on 12/31/16 for $150.00 (Monthly spending allowance) Closing balance 1250.00 1226.50 3985.85 3853.10 2276.78 2230.03 2214.80 1814.55 1964.55 1964.55 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