【发布时间】:2012-03-24 07:00:56
【问题描述】:
这是我的代码(嗯,其中一些)。我的问题是,我可以让前 9 个数字以 00 开头,数字 10 - 99 以 0 开头。
我必须显示所有 360 个月的付款,但如果我没有相同长度的所有月份数字,那么我最终会得到一个不断向右移动并抵消输出外观的输出文件.
System.out.print((x + 1) + " "); // the payment number
System.out.print(formatter.format(monthlyInterest) + " "); // round our interest rate
System.out.print(formatter.format(principleAmt) + " ");
System.out.print(formatter.format(remainderAmt) + " ");
System.out.println();
结果:
8 $951.23 $215.92 $198,301.22
9 $950.19 $216.95 $198,084.26
10 $949.15 $217.99 $197,866.27
11 $948.11 $219.04 $197,647.23
我想看到的是:
008 $951.23 $215.92 $198,301.22
009 $950.19 $216.95 $198,084.26
010 $949.15 $217.99 $197,866.27
011 $948.11 $219.04 $197,647.23
您还需要从我的课程中看到哪些其他代码可以提供帮助?
【问题讨论】: