Commit 37c47d02 by Patryk Czarnik

System.err

parent 192890b6
......@@ -38,12 +38,11 @@ public class Konto {
this.wlasciciel = wlasciciel;
}
public boolean wplata(int kwota) {
public void wplata(int kwota) {
if(kwota > 0) {
this.saldo += kwota;
return true;
} else {
return false;
System.err.println("ujemna kwota wpłaty");
}
}
......
......@@ -30,11 +30,8 @@ public class ProgramBankowy {
System.out.print("Podaj kwotę wpłaty: ");
kwota = sc.nextInt();
sc.nextLine();
if(konto.wplata(kwota)) {
System.out.println("Pieniądze zostały wpłacone");
} else {
System.out.println("Był problem z wpłatą");
}
konto.wplata(kwota);
System.out.println("Pieniądze zostały wpłacone");
}
case "Y" -> {
System.out.print("Podaj kwotę wypłaty: ");
......
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