你好IM。錯誤不能簡單的投資類找到符號
public class Investments
{
//instance variables
private double moneyInvested;
private double investRate;
private int numOfYears;
//construscts a investment with the parameters moneyInvested, double investRate, int numOfYears
public Investments(double moneyInvested, double investRate, int numOfYears)
{
double amount = moneyInvested;
double rate = investRate;
int time = numOfYears;
}
public double ruleOf72()
{
return (72/rate);
}
public int simpleAnnual()
{
return Math.round(amount * Math.pow(1 + rate, time));
}
public int compoundAnnual()
{
return Math.round(amount * Math.pow((1 +rate)^time));
}
}
費率,金額和時間必須在方法之外聲明 – Leo