
package account;

public class SavingsAccount extends Account {

	public SavingsAccount() {
		this(0);
	}

	public SavingsAccount(int startCapital) {
		super(startCapital);
	}
	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<0)
			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);

	}
}
