class Acc {
String accNo; //계좌번호
String ownName; //예금주 이름
int bal; //잔액
Acc(String accNo, String ownName, int bal){
this.accNo=accNo;
this.ownName=ownName;
this.bal=bal;
}
void deposit(int amnt) {
bal+=amnt;
}

int withdraw(int amnt) throws Exception{
if(bal<amnt)
throw new Exception("잔액이 부족합니다.");
bal -=amnt;
return amnt;
}
}

class MinusAcc extends Acc{
int cred; // 마이너스 한도액
MinusAcc(String accNo, String ownName, int bal) {
super(accNo, ownName, bal);
}
@Override
int withdraw(int amnt) throws Exception {
if(bal+cred<amnt)
throw new Exception("인출이 불가능합니다.");
bal -=amnt;
return amnt;
}
}

public class accMain {
public static void main(String args[]) throws Exception {
MinusAcc obj = new MinusAcc();
obj.accNo = "000-11";
obj.ownName = "김선달";
obj.bal = 10;
obj.cred = 5000;
obj.withdraw(50);
try {
System.out.println("인출액:");
System.out.println("잔액:"+obj.bal);
System.out.println("마이너스 한도액:"+obj.cred);

} catch (Exception e){
System.out.println(e.getMessage());
}
}
}