Question: 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);
}
}
Format the following code using Java printf instead of println to look
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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!