/**
* Write a description of class BankAccount here.
*
*/
public class BankAccount
{
// instance variables
protected static double annualInterestRate;// annual interst rate for all account holders.
private double accountBalance;//the amount that the account holder currently has on deposit.
/**
* Constructor for objects of class BankAccount
*/
public BankAccount(double accountBalance)
{
// initialise instance variables
setAccountBalance(accountBalance);
}
public void setAccountBalance(double accountBalance) {
this.accountBalance = accountBalance;
}
public double deposit(double income) {
return accountBalance += income;
}
public double withdraw(double expense) {
return accountBalance -= expense;
}
public static void modifyInterestRate(double rate) {
annualInterestRate = rate;
}
public double calculateMonthlyInterest() {
return accountBalance * annualInterestRate/12;
}
public double getAccountBalance() {
return accountBalance += calculateMonthlyInterest() ;
}
}输入rate=0.015;
但calculateMonthlyInterest return 的值是0.为什么呀
表达的不是很清楚
解决方案 »
- 请问这程序怎么写,需要获取网页上的一个验证码的图片,然后通过一个方法(已经在在,设为X(Image a),然后模拟在网页上的一个文本框中输入,然后获取返回值
- 问个问题
- 关于byte的问题
- 一个关于HIBERNATE的问题
- 关于使用配置文件的一点问题??
- VC有MSDN,JAVA对应的帮助文档应该是什么呢?
- 关于《thinking in JAVA》的问题
- 怪了! IE 问题,请帮忙!
- 非常easy的问题,int的问题
- 关于Java在Linux下的汉字显示问题
- 各位高手,求指点。给出一组英文单词,用hash table with separate chaining 找出出现的频率。
- RCP开发,产品导出时遇到的问题
modifyInterestRate(12);
System.out.println(new BankAccount(0.015).calculateMonthlyInterest());
}
否则计算出来是0