public class MyException extends Exception{
//在此处完成你的代码
private int primMoney=10000;
private int moneyInded;
private int moneyLeft;
public MyException(){}
public MyException(int moneyInded){
this.moneyInded=moneyInded;
}
public String getMoney(int gm)throws MyException{
if(gm<0||gm>primMoney){
throw new MyException(gm);}
int leftmoney=primMoney-gm;
return "现金提取成功!您卡上的余额为:"+leftmoney;
}
public int getMoneyInded(){
return moneyInded;
}
public int getMoneyLeft(){
return moneyLeft;
}
public int getPrimMoney(){
return primMoney;
}
public void setMoneyInded(int moneyInded) {
this.moneyInded=moneyInded;
}
public void setMoneyLeft(int moneyLeft) {
this.moneyLeft=moneyLeft;
}
public void setPrimMoney(int primMoney) {
this.primMoney=primMoney;
}
public void setMoneyLeft(int moneyLeft,int moneyInded ) {
this.moneyLeft=primMoney-moneyInded;
}
public static void main(String[] args) {
//可自行调试,判题不做要求。
}
}