5-4-1 An Amortization Schedule Problem/Specification: Suppose you take out a loan of 81,000 at a yearly interest rate of 10M0 and you intend to repay that loan at $200 (inciuding the interest payment) permonth untii the loan is fully repaid. You would like to have an amortization schedule like the fol- lo wing one: AMORTIZATION TABLE PRINCIPAL $1,000.09 INTEREST 12.00% REGULAR PAYMENT $200.00 NO. INTEREST AMORTIZED BALANCE INTEREST TO DATE 10.00 13.10 2 4.28 28.52 30.81 31.12 810.00 618.19 424.23 228.52 30.81 0.90 19.090 8.10 6.18 4.24 2.29 0.31 199.07 191.99 193.82 195.76 197.71 39.81 1 2 4 LAST PAYMENT = $ 31.12 Write a program to read a loan principal, an interest rate, and a monthly repayment amount and generate an amortization table like the one above. AMORTIZATION TABLE PRINCIPAL: $1000 .0 INTEREST: 12.0% REGULAR PAYMENT $200.0 NO. INTEREST AMORTIZED BALANCE INTEREST TO DATE 1 10.00 190.00 810.00 10.00 2 8.10 191.90 618.10 18.10 3 6.18 193.82 424.28 24.28 4.24 28.52 4 195.76 228.52 2.29 197.71 30.81 30.81 6 0.31 199.69 0.00 31.12
Hello, I am a novice working with Java. I am creating an amortization schedule (pictured below) and have run into an issue. As visible in the example, everything but the final "Amortized" value on the chart is functional. Why is this and how do I fix it?
I believe this may be tied to my "monthint" value and how it handles the "balance" value. Perhaps it's directly tied to my logic behind the "amorized" variable in the loop?
--------------------------------------------------------------------------------
import java.util.Scanner;
public class taxAmortization {
public static void main(String[] args) {
Scanner inKey = new Scanner(System.in);
double principal,interest,repay,monthint,amorized,intdate,balance,finalbal;
int month;
System.out.println("What is the principal on your loan?");
principal = inKey.nextDouble();
System.out.println("What is the interest rate on your loan? (In percent)");
interest = inKey.nextDouble();
System.out.println("What is your monthly loan payment?");
repay = inKey.nextDouble();
intdate = 0;
month = 0;
finalbal = 0;
balance = principal;
System.out.println("\t\t\t\t AMORTIZATION TABLE\n\t\tPRINCIPAL: $" + principal + " INTEREST: " + interest + "% \n\t\t\t REGULAR PAYMENT $" + repay + "\n NO.\tINTEREST\tAMORTIZED\tBALANCE\t INTEREST TO DATE");
while (balance > 0) {
month = month+1;
monthint = ((interest / 100)/12) * balance;
amorized = repay - monthint;
balance = balance - amorized;
intdate = intdate + monthint;
if (balance > 0) {
finalbal = balance;
}
else{
finalbal = 0;
}
System.out.printf(" %d\t\t%.2f\t %.2f\t %.2f\t %.2f",month,monthint,amorized,finalbal,intdate);
System.out.println();
}
}
}
----------------------------------------------------------------------------------
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 1 images