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

//Imports the scanner utility import java.util.Scanner; public class ComputeLoan

ID: 3538903 • Letter: #

Question

//Imports the scanner utility import java.util.Scanner; public class ComputeLoan1 { //Calls the method for variables to be calculated public static double calculations(double loanAmount, double monthlyInterestRate, int numOfYears) { //Declares calculations as monthlyPayment double monthlyPayment = (loanAmount * monthlyInterestRate / (1 - 1 / Math.pow(1 + monthlyInterestRate, numOfYears * 12))); //Value that is returned to the main method return monthlyPayment; }//Closes the calculations method //Final method used to output users calculations public static void finalMethod(String[] args) { //Displays results System.out.println("The monthly payment is " + (int)(monthlyPayment * 100) /100.0); }//Closes the finalMethod //Main method public static void main(String[] args) { //Declarations double loanAmount = 0; double annualInterestRate = 0; double monthlyInterestRate = 0; int numOfYears = 0; double calculations; //Creates a scanner for input from keyboard Scanner input = new Scanner(System.in); //Greeting to the user System.out.println("Welcome to Kentucky Credit Union Loan Calculator!"); System.out.println("This program is used to help calculate the monthly loan amount."); System.out.println(""); //Prompts the user for input System.out.print("Please enter the loan amount: $"); loanAmount = input.nextDouble(); //Accepts input from user and stores it in a variable //Enter yearly interest rate System.out.print("Enter yearly interest rate, for example 7.25: "); annualInterestRate = input.nextDouble(); //Obtain monthly interest rate monthlyInterestRate = annualInterestRate / 1200; //Prompts the user for input System.out.print("Please enter length of the loan in years as an integer, for example 5: "); numOfYears = input.nextInt(); } //Closes the main method }//Closes the class

Explanation / Answer

do { System.out.println("Error, please enter a valid amount: "); dollars =reader.nextInt(); while (dollars >= 301);