ITeye博客

Credit Card

louisling · 2009-09-01 16:05 · Java · C · C++ · C# · Markdown

//e.g. (20, 20), (13, 26)
static void prtCreditCardBill(int billDate, int payLimit) {
    Calendar c = Calendar.getInstance();
    int year = c.get(Calendar.YEAR);
    c.set(year, 0, billDate);
    
    System.out.println("Bill Date     Pay Date");
    System.out.println("-----------------------------");
    for (int i = 0; i < 12; i++) {
        c.set(Calendar.MONTH, i);
        c.set(Calendar.DAY_OF_MONTH, billDate);
        System.out.printf("%1$tF    ", c);

        c.add(Calendar.DAY_OF_MONTH, payLimit);
        System.out.printf("%1$tF\n", c);
    }
}

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。