📄 account.java
字号:
package banking.domain;
public class Account {
protected double balance;
public Account(double init_balance){
this.balance = init_balance;
}
public double getBalance(){
return this.balance;
}
public boolean deposit(double amt){
if (amt>0.0){
this.balance += amt;
return true;
}
return false;
}
public void withdraw(double amt) throws OverdraftException{
if (this.balance-amt>0.0){
this.balance -= amt;
}
else{
throw new OverdraftException("Insufficient funds", amt-this.balance);
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -