
package account;

public class TransferAccount extends Account {

	private int highestCredit;

	public TransferAccount() {
		this(0);
	}

	public TransferAccount(int startCapital) {
		super(startCapital);
		highestCredit=100;
	}
	public void put(int capital) throws AccountException{
		if (capital<0)
			throw new AccountException();
		else super.tranfer(capital);
	}

	public void get(int capital) throws AccountException{
		if (capital<0 )
			throw new AccountException();
		else if( super.getCapital()-capital<-highestCredit)
			throw new AccountException();
		else super.tranfer(-capital);
	}

	public void tranfer(int capital)throws AccountException{
		if (capital>0) put(capital);
		else if (capital<=0) get(-capital);
	}
}
