Lab 3 - Flow control

This lab covers topics from Chapter 3. The following sample programs may be helpful: Complete the following programs and email both files to my Helios account. Name your programs lab3_1.cpp and lab3_2.cpp.
  1. Write a program to track the payments for a no-interest personal loan. The program will take as input the current balance of the loan. Then, until the balance is paid off, the program will output the number of payments made and the current balance and ask the user for how much to pay off. If the user inputs a negative payment or a payment in excess of the balance, an error message should be printed and the user should be prompted to enter a new amount. The output should resemble the following:
    Enter loan balance: 500
    
    0 payments made. Balance is $500. Enter payment amount: 100
    1 payments made. Balance is $400. Enter payment amount: 200
    2 payments made. Balance is $200. Enter payment amount: -5
    $-5 is too low for a payment. Enter payment amount: 100
    3 payments made. Balance is $100. Enter payment amount: 200
    $200 is higher than the balance of $100. Enter payment amount: 100
    
    Loan has been paid off in 4 payments.
    
  2. Modify the program for problem 1 to include interest and minimum payments. Assume the payments are made monthly. The monthly interest rate is 1%. Calculate the interest by multiplying the balance by the interest rate and adding it to the balance before prompting the user for the payment amount. For the minimum payment, the user must pay at least 4% of the balance. Modify the negative payment check from problem 1 to check for a payment less than 4% of the balance instead of a payment less than 0. Modify the "enter payment" prompt to show the minimum payment as well. The output should resemble the following:
    Enter loan balance: 500
    
    0 payments made. Balance is $505 with interest of $5. Minimum payment is $20.
    Enter payment amount: 20
    1 payments made. Balance is $490 with interest of $5. Minimum payment is $19.
    Enter payment amount: 5
    $5 is too low for a payment. Enter payment amount: 50
    2 payments made. Balance is $444 with interest of $4. Minimum payment is $17.
    Enter payment amount: 100
    3 payments made. Balance is $347 with interest of $3. Minimum payment is $13.
    Enter payment amount: 200
    4 payments made. Balance is $148 with interest of $1. Minimum payment is $5.
    Enter payment amount: 100
    5 payments made. Balance is $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.
    
    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.