Write a program to track payments for a personal loan with 10% interest. The program will initially prompt for the loan balance. Then it will enter a loop that calculates the monthly interest (P*ert) and the minimum payment (4% of the outstanding balance). Then a prompt is printed out that says the current balance (with interest added in) and the minimum payment amount. The user is then prompted to enter their payment amount. Read in the payment amount and validate that it is greater than or equal to the minimum payment and less than or equal to the outstanding balance. If the payment is invalid, print out an error message and prompt the user for another payment. If the payment is valid, deduct the payment amount from the balance and go to another iteration of the loop if there is still a balance.
To simplify calculations, you can use integers for the balance and payment. Doubles would be more realistic since it would include cents, but are a bit more complicated as you have to round the interest and minimum payments to 2 decimal places.
The output should resemble the following:
Enter loan balance: 500 Month 1: Balance is $505 ($500 plus interest of $5). Minimum payment is $20. Enter payment amount: 20 Month 2: Balance is $490 ($485 plus interest of $5). Minimum payment is $19. Enter payment amount: 5 $5 is too low. Minimum payment is $19. Enter payment amount: 50 Month 3: Balance is $444 ($440 plus interest of $4). Minimum payment is $17. Enter payment amount: 100 Month 4: Balance is $347 ($344 with interest of $3). Minimum payment is $13. Enter payment amount: 200 Month 5: Balance is $148 ($147 with interest of $1). Minimum payment is $5. Enter payment amount: 100 Month 6: Balance is $48 ($48 with interest of $0). Minimum payment is $1. Enter payment amount: 50 $50 is higher than the balance of $48. Enter payment amount: 48 Loan has been paid off in 6 months.