Question
Assignment 5.22 LoanAmoritzation (due February 4th) The monthly payment for a given loan pays the principal and the interest. The monthly interest is computed by
Assignment 5.22 LoanAmoritzation (due February 4th) The monthly payment for a given loan pays the principal and the interest. The monthly interest is computed by multiplying the monthly interest rate and the balance(the remaining principal). The principal paid for the month is therefore the monthly payment minus the monthly interest. Write a program that lets the user enter the loan amount, number of years, and interest rate then displays the amortization schedule forthe loan. A sample run is shown below.
Note
The balance after the last payment may not be zero. If so, the last payment should be the normal monthly payment plus the final balance.
Hint: Write a loop to displaythe table. Since the monthly payment is the same for each month, it should be computed before the loop. The balance is initially the loan amount. For each iteration in the loop, compute the interest and principal, and update the balance. The loop may lookas follows:
for(i= 1;i<=numberOfYears* 12;i++){
interest=monthlyInterestRate*balance;
principal=monthlyPaymentinterest;
balance=balanceprincipal;
System.out.println(i+ "\t\t" +interest+ "\t\t" +principal+ "\t\t" +balance);
}
A Sample run is shown below:
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started