diff options
Diffstat (limited to 'src/de/fhswf/in/inf/java1/aufgabe5/Konto.java')
| -rw-r--r-- | src/de/fhswf/in/inf/java1/aufgabe5/Konto.java | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/de/fhswf/in/inf/java1/aufgabe5/Konto.java b/src/de/fhswf/in/inf/java1/aufgabe5/Konto.java index a2af51c..faac8f6 100644 --- a/src/de/fhswf/in/inf/java1/aufgabe5/Konto.java +++ b/src/de/fhswf/in/inf/java1/aufgabe5/Konto.java @@ -27,10 +27,8 @@ public class Konto * Owner of the account * @param dispo * Dispo of the account - * @param guthaben - * Initial balance of the account */ - public Konto(Person besitzer, BigDecimal dispo, BigDecimal guthaben) + public Konto(Person besitzer, BigDecimal dispo) { if (besitzer == null) @@ -41,14 +39,16 @@ public class Konto { throw new IllegalArgumentException("Dispo can't be null"); } - if (guthaben == null) + if (dispo.compareTo(BigDecimal.ZERO) < 0) { - throw new IllegalArgumentException("Guthaben can't be null"); + throw new IllegalArgumentException("Dispo can't be negative"); } this.besitzer = besitzer; this.dispo = dispo; - this.guthaben = guthaben; + this.guthaben = new BigDecimal(0); + + this.besitzer.addKonto(this); } @@ -111,9 +111,9 @@ public class Konto * * @return Returns the owners name. */ - public String getBesitzer() + public Person getBesitzer() { - return besitzer.getName(); + return besitzer; } } |
