<div><br></div><div><br></div><div>#Operating System - Mac OS X 10.6.8</div><div>#Python Version - Python 2.6.6</div><div><br></div><div><br></div><div><br></div><div>##Goal:  I am creating a program to calculate credit card payments.</div>


<div>##       The user should be able to put in a credit card balance and interest</div><div>##       rate, and the program will tell them what monthly payment will allow</div><div>##       them to pay off the card in 1 year.  Note: it should only be</div>


<div>##       increments of $10.</div><div>##Problem:  The program returns incorrent values for some inputs.</div><div>##          ie ($1200 balance and 18% interest returns a value of $120.01</div><div>##          for a monthly payment.  Which is fine, but it only takes 11</div>


<div>##          months to pay off that card, not 12.</div><div><br></div><div>##          So, I need to try different payment values and play out the final</div><div>##          balance over 12 months.  But it somehow needs to be dynamic enough</div>


<div>##          to recognize that it will not take 12 months to pay off some values</div><div>##          if we only allow multiples of $10.</div><div><br></div><div>##          I thought of scabbing something on the end that will check negative</div>


<div>##          balances and somehow revert to the previous month but there must be</div><div>##          a cleaner way of doing this. </div><div><br></div><div># code follows:</div><div><br></div><div>print &quot;This will help you pay off your credit card in under 1 year.&quot;</div>


<div><br></div><div><br></div><div>obalance = float(raw_input(&quot;What&#39;s your balance?&quot;))</div><div>#takes user input for balance</div><div>yrate = float(raw_input(&quot;What&#39;s your interest rate?&quot;))</div>


<div>#takes user interest rate</div><div>mrate = yrate / 12.0</div><div>#creates monthly rate</div><div>cbalance = obalance</div><div>#this will be experimental balance based on some monthly payment</div><div>gbalance = 0.0</div>


<div>#this is our goal balance</div><div>incrementpayment = 10.0</div><div>#initial monthly payment</div><div>x = 1</div><div>#our intitial month count</div><div><br></div><div><br></div><div>while cbalance &gt; gbalance:</div>


<div># while our experimental balance is greater than our goal of 0:</div><div>    for i in range (1,x+12):</div><div>        ppayment = incrementpayment - (cbalance * mrate)</div><div>        #amount of payment going to principle</div>


<div>        cbalance = cbalance - ppayment</div><div>        #new experimental balance after payment is applied</div><div>    if cbalance &gt; gbalance:</div><div>        cbalance = obalance</div><div>        incrementpayment = incrementpayment + 10.0</div>


<div>        #resets experimental balance if monthly payment is not enough to reach zero balance</div><div>        </div><div>    else:</div><div>        print &quot;RESULT&quot;</div><div>        print &quot;Months to pay off: &quot;,i</div>


<div>        print &quot;Monthly Payment: $&quot;,incrementpayment</div><div>        print &quot;Ending Balance: $&quot;,cbalance</div><div><br></div>-- <br>Joe<br>
<br>