diff options
| author | Stefan Suhren <suhren.stefan@fh-swf.de> | 2014-10-29 13:21:44 +0100 |
|---|---|---|
| committer | Stefan Suhren <suhren.stefan@fh-swf.de> | 2014-10-29 13:21:44 +0100 |
| commit | cbfcc3df88e229a81da783e258a0b8860404fe1a (patch) | |
| tree | 628595c0fd5d2f6d8ee36bfc6dc203bb9796ecf9 /src/de/fhswf/in/inf/java1/aufgabe5/Konto.java | |
| parent | c8243c6987618ed97c0e89459c6dbc900ffe063e (diff) | |
| download | Java1-cbfcc3df88e229a81da783e258a0b8860404fe1a.tar.gz Java1-cbfcc3df88e229a81da783e258a0b8860404fe1a.zip | |
Assignment No.2 after correction
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; } } |
