martes, 16 de octubre de 2012
Problemset 2: minimum payment
balance=float(raw_input('Enter the outstanding balance on the credit card '))
annualInterestRate=float(raw_input('Enter annual interest rate as a decimal '))
monthlyPaymentRate=float(raw_input('Enter minimum monthly payment rate as a decimal '))
monthlyInterestRate=(annualInterestRate)/12
minimumMonthlyPayment=0
acumulator=0
for num in range(12):
minimumMonthlyPayment=monthlyPaymentRate*balance
balance=(balance-minimumMonthlyPayment)*(1+monthlyInterestRate)
acumulator=float(acumulator+minimumMonthlyPayment)
print 'Month: '+ str(num+1)
print 'Minimum monthly payment: ' + str(round(minimumMonthlyPayment,2))
print 'Remaining balance: ' + str(round(balance,2))
print 'Total paid: ' + str(round(acumulator,2))
print 'Remaining balance: ' + str(round(balance,2))
Suscribirse a:
Enviar comentarios (Atom)
No hay comentarios:
Publicar un comentario