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

number of positive divisors of a locker number is even, then at the end of the g

ID: 3609779 • Letter: N

Question

number of positive divisors of a locker number is even, then at the end of the game the locker is closed.) When you borrow money to buy a house, a car. or for some other purpose, you repay the loan by nuking periodic payments over a certain time. Of course the landing company will charge interest on the loan. Every periodic payment consists of the interest on the loan and the payment toward the principal amount. To be specific, suppose that you borrow $1000 ac the interest rate of 7.2% per year and the payments are monthly. Suppose that your monthly payment is $25. Now the interest is 7.2% per year and the payments are monthly, so the interest rate per month is 7.2/12 = 0.6%. The first month's interest on $1000 is 1000 times 0.006 = 6. Because the payment is $25 and interest for the first month is $6, the payment towards the principal amount is 25 - 6 = 19 This means after making the first payment, the loan amount is 1000 - 19 = 981. For the second payment, the interest is calculated on $981. So the interest for the second month is 981 times 0.006 = 5.886, that is, approximately $5.89. This implies that the payment towards the principal is 25 - 5.89 = 19.11 and the remaining balance after the second payment is 981 - 19.11 = 961.89. This process is repeated until the loan is paid. Write a program that accepts as input the loan amount, the interest rate per year, and the monthly payment. (Enter the interest rate as a percentage. For example, if the interest rate is 7.2% per year, then enter 7.2.) The program then outputs the number of months it would take to repay the loan. (Note that if the monthly payment is less than the first month's interest, then after each payment, the loan amount will increase. In this case, the program must warn the borrower that the monthly payment is too low and with this monthly payment the loan amount could not be repaid.) Enhance your program of Exercise 17. by first telling the user the minimum monthly payment and then prompting the user to enter the monthly payment. Your last payment might be more than the remaining loan amount and interest on it. In this case, output the loan amount before the

Explanation / Answer

please rate - thanks you ask twice, I answer twice, you rate twice- thanks note the commented out cout in the middle of the loop, it will showyou the numbers progressing as you go on. I also pause the program if the payment is too small, so you don'tgo into an infinite loop the last cout is actually part of # 18. (amount of last payment)you can get rid of it, or extra credit maybe #include int main() { double loan,rate,pay,interest; cout.setf(ios::fixed,ios::floatfield); cout.precision(2); int months=0; coutloan; coutrate; rate/=100; rate/=12; interest=loan*rate; coutpay; if(pay