8 Feb 2015

Monthly Payment of a Credit Card

#Python

#Program to calculate minimum Monthly Payment of a Credit Card

balance = 3329
annualInterestRate = 0.2
minimumMonthlyPay=100
newbalance=balance
i=1
monthlyInterestRate=annualInterestRate/12.0

while(i<=12):
    monthlyUnpaidBal=newbalance-minimumMonthlyPay
    newbalance=monthlyUnpaidBal+monthlyInterestRate*monthlyUnpaidBal
    i+=1
       
    if(i==13 and newbalance>0):
        i=1
        a=int(monthlyUnpaidBal/12-monthlyInterestRate*monthlyUnpaidBal)
        if(a<10):
            a=10
        else:
            a=a-a%10
        minimumMonthlyPay+=a
        newbalance=balance       
   
print "Lowest Payment:", minimumMonthlyPay

Categories: , , ,

0 comments:

Post a Comment

Copyright © UPgradeCODING | Powered by Blogger