Package ch.hslu.exercises.sw05.input.ex2
Class BankAccount
java.lang.Object
ch.hslu.exercises.sw05.input.ex2.BankAccount
-
Constructor Summary
ConstructorsConstructorDescriptionErzeugt ein Bankkonto mit Kontostand Null.BankAccount(int balance) Erzeugt ein Bankkonto mit einem Anfangssaldo. -
Method Summary
Modifier and TypeMethodDescriptionvoiddeposite(int amount) Addiert zum bestehen Kontostand einen Betrag hinzu.intGibt den aktuellen Kontostand zurück.voidtransfer(BankAccount target, int amount) Überweist einen Betrag vom aktuellen Bankkonto an ein Ziel-Bankkonto.
-
Constructor Details
-
BankAccount
public BankAccount(int balance) Erzeugt ein Bankkonto mit einem Anfangssaldo.- Parameters:
balance- Anfangssaldo
-
BankAccount
public BankAccount()Erzeugt ein Bankkonto mit Kontostand Null.
-
-
Method Details
-
getBalance
public int getBalance()Gibt den aktuellen Kontostand zurück.- Returns:
- Kontostand.
-
deposite
public void deposite(int amount) Addiert zum bestehen Kontostand einen Betrag hinzu.- Parameters:
amount- Einzuzahlender Betrag
-
transfer
Überweist einen Betrag vom aktuellen Bankkonto an ein Ziel-Bankkonto.- Parameters:
target- Bankkonto auf welches der Betrag überwiesen wird.amount- zu überweisender Betrag.
-