Class BankAccount
java.lang.Object
|
+----BankAccount
-
public class
BankAccount
-
extends Object
Die Klasse BankAccount fuehrt einen einfachen Begriff von Bankkonto ein, bei dem ein Konto durch seinen Kontostand charakterisiert ist. Ausserdem werden einfache Methoden zum Einzahlen und Abheben von einem Konto definiert. Die Methoden deposit und withdraw sind allgemeiner als in der Spezifikation und ueberweisen auch negative Betraege.
-
balance
-
-
BankAccount()
-
Der Standard-Konstruktor setzt den Anfangskontostand auf 0.0.
-
BankAccount(double)
-
Der Konstruktor setzt den Anfangskontostand fest.
-
deposit(double)
-
Die Methode deposit fuegt den Betrag amount zum Kontostand hinzu.
-
getBalance()
-
Die Methode getBalance gibt den aktuellen Kontostand an.
-
toString()
-
Die Methode toString definiert eine textuelle Repraesentation fuer BankAccount-Objekte.
-
transferTo(BankAccount, double)
-
Die Methode transferTo ueberweist den Betrag amount von dem aktuellen Konto auf das Konto other.
-
withdraw(double)
-
Die Methode withdraw hebt den Betrag amount vom Konto ab.
balance
private double balance
BankAccount
public BankAccount()
-
Der Standard-Konstruktor setzt den Anfangskontostand auf 0.0.
BankAccount
public BankAccount(double initialBalance)
-
Der Konstruktor setzt den Anfangskontostand fest.
getBalance
public double getBalance()
-
Die Methode getBalance gibt den aktuellen Kontostand an.
deposit
public void deposit(double amount)
-
Die Methode deposit fuegt den Betrag amount zum Kontostand hinzu.
-
-
Parameters:
-
amount - eingezahlter Betrag, >=0
withdraw
public void withdraw(double amount)
-
Die Methode withdraw hebt den Betrag amount vom Konto ab.
-
-
Parameters:
-
amount - abgehobener Betrag, >=0
transferTo
public void transferTo(BankAccount other,
double amount)
-
Die Methode transferTo ueberweist den Betrag amount von dem aktuellen Konto auf das Konto other.
-
-
Parameters:
-
other - Bankkonto, auf das amount ueberwiesen wird.
-
amount - zu ueberweisender Betrag.
toString
public String toString()
-
Die Methode toString definiert eine textuelle Repraesentation fuer BankAccount-Objekte.
-
-
Overrides:
-
toString in class Object