package account;

public class Account {
	private static int nextId = 1000000;

	private int capital;
	public final int ACCOUNTNUMBER;

	private int lastmoney;

	public Account(){
		this(0);
	}
	public Account(int startCapital){
		this.capital=startCapital;
		ACCOUNTNUMBER=nextId++;
		lastmoney=0;
	}
	public void undoLastOperation() throws AccountException{
		lastmoney=-lastmoney;
		tranfer(lastmoney);
	}
	public int getCapital() {
		return capital;
	}
	public void tranfer(int capital) throws AccountException {
		this.capital += capital;
		lastmoney=capital;
	}
	public String toString(){
		return "Kontonummer: "+ACCOUNTNUMBER+'\n'+
			"Kontoart: "getClass()+'\n'+
			"Kapital: "+getCapital();
	}
}
