Recursive Bisection Search
Please test your code with balance = 5000, annual interest rate = 0.18. (Note, this exercise is basically an AGILE practice). Each month, a credit card statement will come with the option for you to pay a minimum amount of your charge, usually 2% of the balance due. However, the credit card company earns money by charging interest on the balance that you don't pay. So even if you pay credit card payments on time, interest is still accruing on the outstanding balance. Say you've made a $5,000 purchase on a credit card with an 18% annual interest rate and a 2% minimum monthly payment rate. If you only pay the minimum monthly amount for a year, how much is the remaining balance? You can think about this in the following way. At the beginning of month O(when the credit card statement arrives), assume you owe an amount we will call bo (b for balance, subscript to indicate this is the balance at month 0). Any payment you make during that month is deducted from the balance. Let's call the payment you make in month O. Ph. Thus, your unpaid balance for month o, ubo, is equal to bv - po uly = by - no At the beginning of month 1, the credit card company will charge you interest on your unpaid balance. So if your annual interest rate is r, then at the beginning of month 1, your new balance is your previous unpaid balance ubo, plus the interest on this unpaid balance for the month. In algebra, this new balance would be buhi + 12.0 In month 1, we will make another payment, Pi. That payment has to cover some of the interest costs, so it does not completely go towards paying off the original charge. The balance at the beginning of month 2, bz, can be calculated by first calculating the unpaid balance after paying Pl, then by adding the interest accrued: uby = b; -P by = ubi + uby If you choose just to pay off the minimum monthly payment each month, you will see that the compound interest will dramatically reduce your ability to lower your debt. 12.0 Let's look at an example. If you've got a $5,000 balance on a credit card with 13% annual interest rate, and the minimum monthly payment is 2% of the current balance, we would have the following repayment schedule if you only pay the minimum payment each month: Month Balance 0 5000.00 Minimum Payment 100 (= 5000 * 0.02) 99.47 (= 4973.50 -0.02) 98.94 (4947.14 0.02) Unpaid Balance 4900 (= 5000-100) 4874.03 = 4973.50 - 99.47) 4848.20 ( 4947.14 - 98.94) Interest 73.50 (= 0.18/12.0 - 4900) 73.11 (= 0.18/12.0 - 4874.03) 72.72 (-0.18/12.0 4848.20) 1 4973.50 (= 4900 + 73.50) 4947.14 ( 4874.03 + 73.11) 2 You can see that a lot of your payment is going to cover interest, and if you work this through month 12 you will see that after a year, you will have paid $1165.63 and yet you will still owe $4691.11 on what was originally a 55000.00 debt Pretty depressing Problem 4. Recursive Bisection Search In Problem 3, we designed a bisection search to find the monthly minimal monthly payment to pay off the debt in 12 months. Here, please revise your bisection search solution using a recursive function