Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I need this in Java. 1-Create an application that will allow a loan amount, inte

ID: 3855264 • Letter: I

Question


I need this in Java.

1-Create an application that will allow a loan amount, interest rate, and number of finance years to be entered for a given loan. Determine the monthly payment amount. Calculate how much interest will be paid over the loan. Display an amortization schedule showing the new balance after each payment is made Design an object-oriented solution by using the three layers architecture. For the load class, characteristics such as the amount to be financed, rate of interest period of time for the loan, and total interest paid will identify the current state of a loan object. Include methods to determine the monthly payment amount, return the total interest paid over the life of the loan, and return an amortization schedule In the second class, instantiate an object of the load class. Allow the user to input data about more than one loan. Display in the loan LoanApp class the payment amount, amortization schedule, and the total amount of interest to be paid. In the third class, provides a discount percent based on payment amount paid. Note: Test for valid data entries Formulas are needed to calculate the following: numPayments-years 12; term = (1 + rate /12.0)"mPayments term (1+rate/12.0numPayments (2*2) paymentAmounts loanAmount * rate /12 * term/term-1.0) monthinterest- rate/12 *balance Principal = payment-month!nterest Balance balance-principal TotalinterestPaid totalinterestPaid +monthlnterest Discount Amounte paymentAmount discountPercent If paymentArmount >= 2000: discountPercents .2 If paymentAmount >=1000:discoumPercent. I //javalang. Math // For example: double resultsMath.pow(2,2); result is 4.0 Otherwise, discountPercent 0; Note: The desired output is to display the monthly payment amount, an amortization schedule, and the total interest paid over the life of the loan. The following shows a prototype for the final output.

Explanation / Answer

import java.util.Scanner;
class Main{
  
public static void main(String[] args){
double loanAmount,rate;
int years;
Scanner sc=new Scanner(System.in);
System.out.print("Enter amount of loan:");
loanAmount=sc.nextFloat();
System.out.print("Enter interest rate per year:");
rate=sc.nextFloat();
System.out.print("Enter number of years:");
years=sc.nextInt();
calAmort(loanAmount,rate,years);
  
}

public static void calAmort(double loanAmount,double rate, int years){
double newbal;
double monthlyInterest=(rate/12)/100;
int nm=years*12;
double mp,ip,pp;
int i;
  
mp=loanAmount*monthlyInterest*Math.pow(1+monthlyInterest,(double)nm)/(Math.pow(1+monthlyInterest,(double)nm)-1);
printHeader();
//print amortization schedule for all months except the last month
for(i=1;i<nm;i++){   
ip=loanAmount*monthlyInterest;//interest paid
pp=mp-ip; //princial paid
newbal=loanAmount-pp; //new balance   
printSch(i,loanAmount,mp,ip,pp,newbal);
loanAmount=newbal; //update old balance
}
//last month
pp=loanAmount;
ip=loanAmount*monthlyInterest;
mp=pp+ip;
newbal=0.0;
printSch(i,loanAmount,mp,ip,pp,newbal);   
}

public static void printSch(int i,double p,double mp,double ip,double pp,double newbal){
System.out.format("%-8d%-12.3f%-10.3f%-10.3f%-10.3f%-12.3f ",i,p,mp,ip,pp,newbal);
}

public static void printHeader(){
int i;
System.out.println(" Amortization Schedule for Borrower");
for(i=0;i<62;i++) System.out.print("-");
System.out.format(" %-8s%-12s%-10s%-10s%-10s%-12s"," ","Old","Monthly","Interest","Principle","New","Balance");
System.out.format(" %-8s%-12s%-10s%-10s%-10s%-12s ","Month","Balance","Payment","Paid","Paid","Balance");
}

}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote