Commit a90f0258 by Patryk Czarnik

Konto - sprawdzanie także w konstruktorze

parent 2a0834a9
......@@ -6,8 +6,11 @@ public class Konto {
private int saldo;
public Konto(int numer, Osoba wlasciciel, int saldo) {
if(saldo < 0) {
throw new IllegalArgumentException("Saldo ujemne");
}
this.numer = numer;
this.wlasciciel = wlasciciel;
this.setWlasciciel(wlasciciel);
this.saldo = saldo;
}
......@@ -28,6 +31,9 @@ public class Konto {
}
public void setWlasciciel(Osoba wlasciciel) {
if(wlasciciel == null) {
throw new IllegalArgumentException("Wlasciciel nieokreślony");
}
this.wlasciciel = wlasciciel;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment