mortgage payment

mortgage payment - /process/1 figure out...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
package mortgagepayment; import java.util.Scanner; /** * * @author Manny */ public class MortgagePayment { public static void main(String[] args) { Scanner in = new Scanner(System.in); //input System.out.print("Enter the loan amount: "); double loanAmount = in.nextDouble(); System.out.print("Enter your interest rate (e.g. 7): "); double intRate = in.nextDouble(); System.out.print("Enter your loan term (number of year): "); int loanTerm = in.nextInt();
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: //process //1. figure out monthlyInterestRate double monthlyInterestRate = intRate / 1200; //2. apply the formula double monthlyPmt = (loanAmount*monthlyInterestRate) / (1 - ( 1 / Math.pow(1+monthlyInterestRate, loanTerm*12))); double totalPmt = monthlyPmt * loanTerm * 12; //output System.out.printf("The monthly mortgage payment is: $%,.2f\n", monthlyPmt); System.out.printf("The total payment is: $%,.2f\n", totalPmt); } }...
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online