package bank;
public class AccountOverdrawException extends Exception{
float drawMoney,accountMoney;
public AccountOverdrawException(float drawMoney,float accountMoney){
this.drawMoney=drawMoney;
this.accountMoney=accountMoney;
}
public String get(){
if(this.drawMoney>this.accountMoney){
return "You can not do it!";
}
}
}
public class InvalidDepositException extends Exception{
float depositMoney;
public InvalidDepositException(float depositMoney){
this.depositMoney=depositMoney;
}
public String get(){
if(this.depositMoney<0){
return "The number of depositMoney is unreasonable!";
}
}
}
这样可以吗?