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

please, use jave for this coading and use (main ) and ( classes) show all step i

ID: 3664374 • Letter: P

Question

please, use jave for this coading

and use (main ) and ( classes)

show all step in question and explian the step

PLEASE ,can you same all varible

should be the main faction in one file

and other calculation in other file and main call

PARTA: LoanCalculator Requirements Step 1: Create a LoanCalculator class with the following structure /*This class provides the service of calculating the payment necessary to pay off a loan/ public class LoanCalculator [ public double monthlyPayment double principle, double interestRate, int term) //missing code.... public void displaySchedule ( double principle, double interestRate, int term) //missing code... //end of class LoanCalculator Step 2: The interestR between 0.0 and 100.0 (e.g. 5.0 for 5%). Step 3: Provide the public double monthlyPayment (double principle, double interestRate, int term) method that returns the dollar amount that would be required to pay off the principle at the given in the monthly interest rate as a fraction (i.e. interestRate/100/12) and t the term in months then the monthly payment is given by the formula: monthlyPayment = A * r * (r + 1)' / ((r + 1)-1 ) Step 4: The pri number of months over which the loan is to be paid off. Step 5: Provide the public void dis laySchedule (···) method which will display on System.out the repayment schedule of the loan. See the sample output for the program shown below ate parameter should be the annual interest rate expressed as a double terest rate over the term. If A is the principle, r ciple should be the amount of money borrowed and the term should be the Step 6: The displaySchedule ) method should show the total amount of money paid (see sample output below). Step 7: All money values should be shown with two decimal places (e.g. $100.00) and a S sign.

Explanation / Answer

The program is supposed to have one method that calculates the monthly rate, one method that calculates and returns the monthly payment and a method to print the loan statement (amt borrowed,annual interest rate, number of months, and the monthly payment).

import java.util.*;

class LoanCalculator
{

//----------------------------------
// Data Members
//----------------------------------

/**
* Constant for the number of months in a year
*/
private final int MONTHS_IN_YEAR = 12;
  
/**
* The main window of the program
*/
private MainWindow mainWindow;

/**
* InputBox for getting three input values
*/
private InputBox inputBox;
  
/**
* OutputBox for displaying the input values
* and the payments
*/
private OutputBox outputBox;

/**
* Input to the program - the amount of the loan
*/
private float loanAmount;
  
/**
* Input to the program - the annual interest rate
*/
private float annualInterestRate;
  
/**
* The monthly interest rate
*/
private float monthlyInterestRate;
  
/**
* The monthly loan payment
*/
private double monthlyPayment;
  
/**
* The total loan payment
*/
private double totalPayment;

/**
* Input to the program - the loan period in years
*/
private int loanPeriod;
  
/**
* The number of monthly payments
*/
private int numberOfPayments;


//----------------------------------
// Constructors
//----------------------------------

public LoanCalculator()
{
mainWindow = new MainWindow("L O A N C A L C U L A T O R");
inputBox = new InputBox(mainWindow);
outputBox = new OutputBox(mainWindow);
}

//-------------------------------------------------
// Public Methods:
//
// void start ( )
//
//------------------------------------------------
  
/**
* Top level method that calls other private methods
* to compute the monthly and total loan payments
*/
public void start()
{
mainWindow.setVisible( true );
outputBox.setVisible( true );
  
describeProgram(); //tell waht the program does
getInput(); //get three input values
computePayment(); //compute the monthly payment and total
displayOutput(); //diaply the results
}

//-------------------------------------------------
// Private Methods:
//
// void computePayment ( )
// void describeProgram ( )
// void displayOutput ( )
// void getInputs ( )
//
//------------------------------------------------
  
/**
* Computes the monthly and total loan payments.
*/
private void computePayment()
{
monthlyInterestRate = annualInterestRate / 100.0f / MONTHS_IN_YEAR;
numberOfPayments = loanPeriod * MONTHS_IN_YEAR;

monthlyPayment = (loanAmount * monthlyInterestRate) /
(1 - Math.pow(1/(1 + monthlyInterestRate),
numberOfPayments ) );

totalPayment = monthlyPayment * numberOfPayments;
}

/**
* Provides a brief explaination of the program to the user.
*/
private void describeProgram()
{
outputBox.printLine("This program computes the monthly and total");
outputBox.printLine("payments for a given loan amount, annual ");
outputBox.printLine("interest rate, and loan period (# of years)");
outputBox.skipLine(2);
}


/**
* Display the input values and monthly and total payments.
*/
private void displayOutput()
{
outputBox.printLine("For");
outputBox.printLine("Loan Amount: $" + loanAmount);
outputBox.printLine("Annual Interest Rate: " + annualInterestRate + "%");
outputBox.printLine("Loan Period (years): " + loanPeriod);
outputBox.skipLine(1);

outputBox.printLine("Monthly payment is $ " + monthlyPayment);
outputBox.printLine(" TOTAL payment is $ " + totalPayment);
}   


/**
* Gets three input values--loan amount, interest rate, and
* loan period--using an InputBox object
*/
private void getInput()
{
loanAmount = inputBox.getFloat("Loan Amount (Dollars&Cents):");
annualInterestRate = inputBox.getFloat("Annual Interest Rate (e.g. 9.5):");
loanPeriod = inputBox.getInteger("Loan Period - # of years:");
  
}
  
}