Question: Java Loan Calculator. Wrote code for a loan calculator but mypayments seem to be calculating too high. ive attached theinstructions given and the code I

Java Loan Calculator. Wrote code for a loan calculator but mypayments seem to be calculating too high. ive attached theinstructions given and the code I wrote. wondering if my monthlypayment and total payment formulas are written correctly? any helpwould be appreciated.Write a Java Program to create a Software for Loan Payment Program.

My Code:

The program should ask the user to input the Number of Years,

public class Assignment2 {    public static void main(String[] args){        //Creating the Scanner object        Scanner input = new Scanner(System.in);        //have user input number of years, rate of interest and loan amount        System.out.print("Enter loan term in years: ");        int numberOfYears = input.nextInt();        System.out.print("Enter interest rate: ");       double  monthlyInterestRate = input.nextDouble();        System.out.print("Enter loan amount: ");        double loanAmount = input.nextDouble();        //calculate monthly payments        double monthlyPayment = ((loanAmount * monthlyInterestRate) / (1 - (1 / Math.pow(1 + monthlyInterestRate,                numberOfYears * 12))));        //display monthly payment details to console        System.out.print("Your monthly payment is: ");        System.out.println(monthlyPayment);        //calculate total payment        double totalPayment = (monthlyPayment * numberOfYears * 12);        //display monthly total details to console        System.out.print("Your total payment is: ");        System.out.println(totalPayment);    }}

Write a Java Program to create a Software for Loan Payment Program. The program should ask the user to input the Number of Years, Rate of Interest and Amount of Loan in 3 separate lines, and provide the Monthly payment, and Total Payment in 2 separate lines. Calculate the Monthly payment and Total Payment using the following formula: loanAmount X monthlyInterestRate monthlyPayment 1 1 monthlyInterestRate)numberOfYears 12 (1 + totalPayment = monthly Payment X numberOfYears X 12

Step by Step Solution

3.58 Rating (169 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!