verwende reale Restschuld zur Zinsbetragberechnung
This commit is contained in:
		@@ -302,18 +302,18 @@ class Darlehenberechner {
 | 
			
		||||
      boolean sondertilgungFaellingErstesJahr = summeMonate < 12 && aktMonat.getMonth() == Month.DECEMBER;
 | 
			
		||||
      if (sondertilgungFaellingErstesJahr || summeMonate > 1 && aktMonat.getMonth() == Month.JANUARY) {
 | 
			
		||||
         aktRestschuld = aktRestschuld.compareTo(sondertilgung) > 0 ? aktRestschuld.subtract(sondertilgung) : aktRestschuld;
 | 
			
		||||
         System.out.println(aktMonat + ": " + DECIMAL_FORMAT.format(sondertilgung) + " = 0,00 + " + DECIMAL_FORMAT.format(sondertilgung) + " | " + DECIMAL_FORMAT.format(getRestschuldFuerOutput()));
 | 
			
		||||
         System.out.println(aktMonat + ": " + DECIMAL_FORMAT.format(sondertilgung) + " = 0,00 + " + DECIMAL_FORMAT.format(sondertilgung) + " | " + DECIMAL_FORMAT.format(getRealeRestschuld()));
 | 
			
		||||
      }
 | 
			
		||||
   }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
   private BigDecimal getRestschuldFuerOutput() {
 | 
			
		||||
   private BigDecimal getRealeRestschuld() {
 | 
			
		||||
      return restschuld != null ? aktRestschuld.add(restschuld) : aktRestschuld;
 | 
			
		||||
   }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
   private void berechneBeitragAufteilung() {
 | 
			
		||||
      aktZinsbetrag = aktRestschuld.multiply(zinssatz)
 | 
			
		||||
      aktZinsbetrag = getRealeRestschuld().multiply(zinssatz)
 | 
			
		||||
         .divide(ZWOELF, MathContext.DECIMAL128);
 | 
			
		||||
      if (aktMonatlicheRate.compareTo(aktRestschuld) > 0) {
 | 
			
		||||
         aktMonatlicheRate = aktRestschuld.add(aktZinsbetrag); // die letzte Rate ist gleich der Restschuld + Zinsen
 | 
			
		||||
@@ -329,7 +329,7 @@ class Darlehenberechner {
 | 
			
		||||
 | 
			
		||||
   private void druckeAktuelleMonatswerte() {
 | 
			
		||||
      System.out.println(aktMonat + ": " + DECIMAL_FORMAT.format(aktMonatlicheRate) + " = " + DECIMAL_FORMAT.format(aktZinsbetrag)
 | 
			
		||||
            + " + " + DECIMAL_FORMAT.format(aktTilgungsbetrag) + " | " + DECIMAL_FORMAT.format(getRestschuldFuerOutput()));
 | 
			
		||||
            + " + " + DECIMAL_FORMAT.format(aktTilgungsbetrag) + " | " + DECIMAL_FORMAT.format(getRealeRestschuld()));
 | 
			
		||||
   }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@@ -392,6 +392,6 @@ class Darlehenberechner {
 | 
			
		||||
      int laufzeitJahreFinal = summeMonate / 12;
 | 
			
		||||
      int teillaufzeitMonateFinal = summeMonate % 12;
 | 
			
		||||
      System.out.println("Laufzeit: " + laufzeitJahreFinal + " Jahre " + teillaufzeitMonateFinal + " Monate");
 | 
			
		||||
      System.out.println("Restschuld: " + DECIMAL_FORMAT.format(getRestschuldFuerOutput()));
 | 
			
		||||
      System.out.println("Restschuld: " + DECIMAL_FORMAT.format(getRealeRestschuld()));
 | 
			
		||||
   }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user