package oop.Aufgaben;

public class BankKonto {
	
	private String name;
	private double amount;
	private int kontoNummer;
	private static int counter = 1;
	
	public BankKonto() {
		
		
	}
	
	
	
	public BankKonto( String name,double amount) {
		this.kontoNummer = counter;
		this.name = name;
		this.amount = amount;
		counter++;
		bounus();
		willkommen(this.name);
		}
	
	
	public static void willkommen(String n) {
	
		BankKonto b1 = new BankKonto();
		b1.name = n;
		System.out.println("Willkommen: " + b1.name);
	}
	
	
	public double bounus() {
		
		
		return this.amount += 5;
	}
	
	public void einzahlung(double wert) {
		
		this.amount += wert;
		
	}
	
	public void auszahlung(double wert) {
		
		if (wert <= this.amount)
			this.amount -= wert;
		else
			System.out.println("Das Geld reicht nicht aus!");
	}
	
	public void checkKonto() {
		
		System.out.println("Ihre Stand ist: " + this.amount);
	}
	
	public String toString() {
		
		return "Kontoname = " + this.name + " nummer = " + kontoNummer + " Satand = " + this.amount; 
	}

}
