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

This is a homework fo?r JAVA programming! Write a program that reads in the amou

ID: 3672697 • Letter: T

Question

This is a homework fo?r JAVA programming!

Write a program that reads in the amount of a monthly mortgage payment and the outstanding balance (i.e., the amount still owed) and then outputs the amount of the payment that goes to interest and the amount that goes to principal (i.e.: the amount that goes to reducing the debt). Assume that the annual interest payment is 7.49 percent. Use a defined constant for the interest rate. Note that payments are made monthly, so the interest is only one-twelfth of the annual interest rate of 7.49 percent, Determine the interest amount, the Principal amount and the New Balance after the monthly payment has been made. Print Screen your results using the following 3 test cases and one of your own. Note: If you are using a Number Format object to format dollar amounts, then negative numbers will show up with parenthesis around them instead of a negative sign in front. This is fine.

Explanation / Answer

import java.text.NumberFormat;
import javax.swing.JOptionPane;
public class MortgagePaymentCalc
{
public static final double INTEREST_RATE = .0749;
public static void main(String[] args)
{
NumberFormat moneyFormatter = NumberFormat.getCurrencyInstance();
JOptionPane.showMessageDialog(null, "Welcome to the Mortgage Payment Calculator.");
String balanceAmountTxt = JOptionPane.showInputDialog(null, "Please enter your remaining loan balance:");
double balanceAmount = Double.parseDouble(balanceAmountTxt);
double monthlyInterest = ((balanceAmount * INTEREST_RATE)/12);
JOptionPane.showMessageDialog(null, "Your current monthly interest is: " + moneyFormatter.format(monthlyInterest));
String monthlyPaymentAmountTxt = JOptionPane.showInputDialog(null, "Please enter the amount of your monthly mortgage payment");
double monthlyPaymentAmount = Double.parseDouble(monthlyPaymentAmountTxt);
double monthlyPrincipleAmount = (monthlyPaymentAmount - monthlyInterest);
String txtOutput = ("Payment Amount: " + moneyFormatter.format(monthlyPaymentAmount) + " ");
txtOutput = txtOutput + ("Monthly Interest:" + moneyFormatter.format(monthlyInterest) + " ");
txtOutput = txtOutput + ("Principle Amount:" + moneyFormatter.format(monthlyPrincipleAmount) + " ");
JOptionPane.showMessageDialog(null, txtOutput);
}
}

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