3.4
Python
code
# 3.4.py
# 18:06 2015-04-04
# r, rate
# n, number of periods
# ma, maximum amount
# a, monthly payments
# f, the total fees
# p, present value
r = 0.08083 / 12
n = 30 * 12
ma = 203150
p = ma
a = r * (1 + r)**n * p / ((1 + r)**n - 1)
r = 0.07875 / 12
n = 30 * 12
p = a / r * (1 - 1 / (1 + r)**n)
f = p - ma
fmt="{:25}{:10d}{:}"
print(fmt.format("monthly payments is" , round(a), "($)"))
print(fmt.format("total initial balance is ", round(p), "($)"))
print(fmt.format("the total fees is ", round(f), "($)"))
# end
output
monthly payments is 1502($) total initial balance is 207210($) the total fees is 4060($)
Fortran
history
(2004-4-25, revised on 2014-08-16, 2015-04-04, 2016-10-10.)
2021-02-15 change XHTML to html5, change shift-jis to utf-8, add viewport.