Reference no: EM132200993
Write a Java program that reads the amount of a mortgage payment (as a double) and the amount still owed - the outstanding balance - on the mortgage (also as a double) and then displays the amount of the payment that goes towards interest and the amount that goes towards principal (e.g. the amount that goes towards reducing the debt).
Assume that the annual interest rate is 4% (which is the current rate). Be sure to use a named constant for this interest rate.
Note that mortgage payments are made monthly, so be sure to divide the annual rate by 12 when calculating the amount of the mortgage payment that goes towards interest.
Here is a sample transaction with the user:
Please enter your mortgage payment: $2500.00
Please enter ourstanding balance or mortgage: $450000.00
Of your $2,500.00 mortgage payment:
$1,500.00 goes to interest
$1,000.00 goes to principal
calculation: 450000 * 0.04 / 12 = 1500