account.java
来自「本程序用Java语言描述了一个基本的银行管理系统」· Java 代码 · 共 29 行
JAVA
29 行
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 + =
减小字号Ctrl + -
显示快捷键?