Sondertilgung optional

This commit is contained in:
fabianArbeit 2025-03-26 16:40:14 +01:00
parent 20641043d3
commit 014c7f4786

View File

@ -165,8 +165,11 @@ class Darlehenberechner {
}
System.out.print("Monat erste Rate(z.B. 2007-12): ");
konfig.setAnfangsmonat(YearMonth.parse(dis.readLine()));
System.out.print("Sondertilgungssatz: ");
konfig.setSondertilgungProzent((BigDecimal) DECIMAL_FORMAT.parse(dis.readLine()));
System.out.print("Sondertilgungssatz(optional): ");
in = dis.readLine();
if (in != null && !in.isBlank()) {
konfig.setSondertilgungProzent((BigDecimal) DECIMAL_FORMAT.parse(in));
}
new Darlehenberechner(konfig).berechneWerte();
/*var konfig = new Konfiguration();
@ -261,7 +264,7 @@ class Darlehenberechner {
private void zahleSondertilgung() {
if (sondertilgung.signum() == 0) {
if (sondertilgung == null || sondertilgung.signum() == 0) {
return;
}
boolean sondertilgungFaellingErstesJahr = summeMonate < 12 && aktMonat.getMonth() == Month.DECEMBER;