package account;

public class CreditAccount extends Account {

	public CreditAccount() {
		this();
	}

	public CreditAccount(int money) {
		super(-money);
	}
	public void put(int capital) throws AccountException{
		if (capital<0)
			throw new AccountException();
		else if(super.getCapital()+capital>0)
			throw new AccountException();
		else super.tranfer(capital);
	}
	public void tranfer(int capital) throws AccountException {
		if (capital>0) put(capital);
		else if (capital<0)throw new AccountException();
	}
}
