hfernandes

problem 2 PS#1

Sep 8th, 2011
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.32 KB | None | 0 0
  1. ##O2F - vFinal
  2.  
  3. ## -- Starting variable definition --
  4.  
  5. iloan=float(raw_input('valor: '))                   #initial balance
  6. arate=float(raw_input ('annual rate: '))                #annual rate
  7. mrate=arate/12                              #month rate
  8. mmp=10                                  #initial minimum pay
  9. month=0                                 #months counter start
  10. fmonth=12                               #final months (1 yr)
  11.  
  12.  
  13. ##mmp=float(raw_input ('valor minimo que quer pagar [TESTE]: '))    # /*if you with to start with other mmp - note: comment previous defined mmp and uncomment this one */
  14.  
  15. ##fmonth=int(raw_input ('meses: '))                     # /*if you want to change the max paying months available - note: comment previous defined fmonth and uncomment this one */
  16.  
  17. loan=iloan
  18.  
  19. ## -- Starting Iteration--: /* While the loan is greater than 0 and the month are less or at least equal to "fmonth" it tests for the initial mmp set, if the months pass the "fmonth" set it resets month's counter and increment mmp with 10. */
  20.  
  21. while loan>0:
  22.     if(month<=fmonths):
  23.         loan=loan*(1+mrate)-mmp
  24.         month=month+1
  25.         if month==fmonths+1:
  26.                 month=0
  27.                 mmp=mmp+10
  28.                 loan=iloan
  29.                 ##print mmp                         # uncomment only for debbuging :P
  30.    
  31. print ('what you have to pay per month: '), mmp, ('$')
  32. print ('how many months you need: '),month
  33. print ('what is the final balance: '), loan
Advertisement
Add Comment
Please, Sign In to add comment