好吧,在“Money.java”中,我创建了一个货币对象。下面是对象:
public Money(double amount)
{
if (amount < 0)
{
System.out.println(
"Error: Negative amounts of money are not allowed.");
System.exit(0);
}
else
{
long allCents = Math.round(amount*100);
dollars = allCents/100;
cents = allCents%100;
}
}
现在,我正在尝试根据这个对象设置变量,但我的思绪一定已经消失了,我收到了这个错误:
CreditCard.java:26: error: cannot find symbol
balance = Money(0.00);
^
symbol: method Money(double)
location: class CreditCard
我不能把事情放在一起,看看我的错误。