Starting from:

$10

mortgage

This program will allow the user to enter the principal amount that they're borrowing,
the interest rate, and the length in years. Then, it will print a mortgage loan payoff table.
Algorithm:
1) Input principal (the amount borrowed)
2) Input interest (the interest rate annually)
3) Input lengthYears (the number of years of the loan)
4) Calculate the monthlyPayment using the formula provided below
monthlyPayment = principal * (decimalInterest / (1 - (1 + decimalInterest)^(-lengthMonths)))
5) Compute the monthlyInterest by multiplying principal by the decimalInterest
6) Compute the monthlyPrincipal by taking monthlyPayment and subtract monthlyInterest
7) Compute the newBalance by taking the principal and subtract monthlyPrincipal
8) Make the newBalance become the principal
9) Loop step 5 through 8 until principal is 0
10) Prompt the user if they want to repeat back to step 1, so nested loop
11) If they press Y, clear the screen and go back to step 1. If they press N, exit the loop.

More products