Question: java You are going to write a program which will display the payment schedule for a loan given an interest rate and the number of
"java"
You are going to write a program which will display the payment schedule for a loan given an interest rate and the number of payments.
Prompt the user for a loan amount, the annual interest rate, number of years to pay off the loan. First, you will calculate the monthly payment using a formula below. Then you will write a loop displaying the monthly payment breakdown: interest amount, principal applied to the loan, and the balance of the loan.
For a 1 year loan (12 monthly payments) for $10,000 at 7%, the payment breakdown looks like the following:
monthly payment = 865.27 payment:1 interest: 58.33 principal: 806.93 balance: 9193.07
The formula:
balance = balance * (1 + interestRate / 12) - monthlyPayment
/*
I do not want the solution to start this way
import java.text.NumberFormat; import java.util.Scanner;
public class MothlyPay {
public static double calculateMonthlyPayment( int loanAmount, int termInYears, double interestRate) {
interestRate /= 100.0;
double monthlyRate = interestRate / 12.0;
int termInMonths = termInYears * 12;
double monthlyPayment = (loanAmount*monthlyRate) / (1-Math.pow(1+monthlyRate, -termInMonths));
return monthlyPayment; }
*/
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
