【发布时间】:2015-05-06 10:22:16
【问题描述】:
这里需要一些有关日期类型的帮助。
我正在使用以下参数管理 CreditCard 类
public class CreditCard extends Card{
Date monthlyFee;
double amount2pay;
public CreditCard(StandardAccount yourAssociatedBankAccount,Date monthlyFeeDay) {
super(yourAssociatedBankAccount);
monthlyFee=monthlyFeeDay;
cardType="Credit Card";
}
创建 CreditCard 时,我必须设置 MonthlyFeeDay(例如“今天 + 30 天”)。
以下函数必须创建信用卡
public void createCreditCard(StandardAccount anAccount){
Date today= new Date();
Card newCard= new CreditCard(anAccount,today);
anAccount.addCard(newCard);
cardsList.add(newCard);
}
事实是,我不知道如何将变量“今天”增加 30 天。我不知道如何设置下个月的日期。 有什么提示吗?
【问题讨论】:
-
这里使用的是什么Java版本?