?? checkingaccount.java
字號:
package banking.domain;
public class CheckingAccount extends Account {
private double overdraftProtection;
public CheckingAccount(double balance){
super(balance);
this.overdraftProtection = 0.0;
}
public CheckingAccount(double balance, double oP){
super(balance);
this.overdraftProtection = oP;
}
public void withdraw(double amt) throws OverdraftException{
if (this.balance-amt>0.0){
this.balance -= amt;
}
else if (this.overdraftProtection==0.0)
throw new OverdraftException("No overdraft protection", amt-this.balance);
else if (this.balance+this.overdraftProtection-amt>0.0){
this.overdraftProtection -= (amt-this.balance);
this.balance = 0.0;
}
else
throw new OverdraftException("Insufficient funds for overdraft protection", amt-this.balance);
}
public double getOverdraftProtection(){
return this.overdraftProtection;
}
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -