petrissimo

OCW 6-00 sc. PS1 (round option)

Nov 7th, 2012
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.15 KB | None | 0 0
  1.  
  2.  
  3. balance = float(raw_input('Enter the outstanding balance on the credit card: '))
  4.  
  5. annualRate = float(raw_input('Enter the annual interest rate on the credit card: '))
  6.  
  7. minPaymentRate = float(raw_input('Enter the minimum monthly payment rate on the credit card: '))
  8.  
  9.  
  10. print("\n")
  11.  
  12. monthly_rate = annualRate/12
  13.  
  14. print("\n")
  15.  
  16. months = int(0)
  17. minMonPay = float (0) #minimum monthly pay
  18. intsPaid = float (0) #interests paid
  19. principalPaid = float(0)
  20. totalAmountPaid = float(0)
  21.  
  22. while months<12:
  23. months = months+1
  24. print 'month:', months
  25.  
  26. minMonPay = (minPaymentRate * balance)
  27. print 'minimum monthly payment:', '$', round(minMonPay, 2)
  28. intsPaid = monthly_rate * balance
  29. principalPaid = minMonPay - intsPaid
  30. print 'principal Paid', '$', round(principalPaid, 2)
  31. balance = (balance - (principalPaid))
  32. balanceStr = str(balance)
  33. print 'remaining balance', '$', round(balance, 2)
  34. totalAmountPaid = (totalAmountPaid + minMonPay)
  35. print("\n")
  36.  
  37. print "RESULT\n"
  38. print 'remaining balance', '$', round(balance, 2)
  39. print '$', 'Total amount paid', round(totalAmountPaid, 2)
Advertisement
Add Comment
Please, Sign In to add comment