-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathProgram Set 2-1.py
26 lines (18 loc) · 1.03 KB
/
Program Set 2-1.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
balance = float(raw_input('balance: '))
annualInterestRate = float(raw_input('annualInterestRate: '))
monthlyPaymentRate = float(raw_input('monthlyPaymentRate: '))
TotalPaid = 0
MonthlyInterestRate = annualInterestRate / 12.0
PreviousBalance = balance
for mouth in range(1,13):
MinimumMonthlyPayment = monthlyPaymentRate * PreviousBalance
MonthlyUnpaidBalance = PreviousBalance - MinimumMonthlyPayment
UpdatedBalanceEachMonth = MonthlyUnpaidBalance + (MonthlyInterestRate * MonthlyUnpaidBalance)
PreviousBalance = UpdatedBalanceEachMonth
print 'Month: ' + str(mouth)
print 'Minimum monthly payment: ' + str(round(MinimumMonthlyPayment,2))
print 'Monthly interest rate: ' + str(round(MonthlyInterestRate * UpdatedBalanceEachMonth,2))
print 'Remaining balance: ' + str(round(UpdatedBalanceEachMonth,2))
TotalPaid = TotalPaid + MinimumMonthlyPayment
print 'Total paid: ' + str(round(TotalPaid,2))
print 'Remaining balance: ' + str(round(UpdatedBalanceEachMonth,2))