- 2 55 Points In This Programming Problem We Will Use A Brute Force Approach To Compute The Monthly Mortgage Payment G 1 (54.77 KiB) Viewed 30 times
2 (55 points) In this programming problem, we will use a brute force approach to compute the monthly mortgage payment, g
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am
2 (55 points) In this programming problem, we will use a brute force approach to compute the monthly mortgage payment, g
2 (55 points) In this programming problem, we will use a brute force approach to compute the monthly mortgage payment, given the principal, annual percentage rate (APR), and the term (number of months). In this approach, we start with an estimate of the monthly payment. Based on this estimate, we compute the remaining principal at the end of the term. If the remaining principal is negative, we reduce the estimated monthly payment by $1. If the remaining principal is larger than the monthly payment, we increase the monthly payment by $1. The iteration stops when in the last month, the remaining principal is positive but less than the monthly payment. The flow diagram below shows the algorithm. Note that the monthly interest rate is APR/12.0. principal 300000 annual PercentageRate= 0.035 term 300 monthly Payment = 2000 (est.) = Compute the remaining principal at end of term (last month) remaining principal 02 < yes reduce monthly payment by $1 no remaining principal > monthlyPayment? yes increase monthly payment by $1 no display monthly payment and the last payment amount Implement the algorithm. Be sure to use comments to explain your program and use proper indentation.