12-14-2019, 02:46 PM
Blog Link: http://edspi31415.blogspot.com/2019/12/h...-loan.html
Introduction
The program AMORT calculates:
* The monthly payment of a loan.
* An amortization table where the year's interest and principal is calculated.
* The amount of the final payment based on the balance.
Assumptions:
* Payments are made at the end of the month.
* The payment and the amount of interest calculated at each month are rounded to the nearest two decimal places. Not every one in finance follows this practice, so you mileage may very.
HP 71B Program: AMORT
Notes:
* There is no rounding command in the HP 71B's programming language. Lines 140 and 220 has a formula for rounding results to two decimal places:
IP(100*n+.5)/100
* STD is floating point display mode (standard)
* CHR$(28) prints the capital Sigma character, "Σ"
Examples
Example 1:
Loan: $35,000.00
Rate: 5.8%
Term: 5 years
Payment: $673.40
Year 1: Interest: $1,866.54, Principal: $6,214.26, Balance: $28,785.74
Year 2: Interest: $1,496.37, Principal: $6,584.43, Balance: $22,201.31
Year 3: Interest: $1,104.14, Principal: $6,976.66, Balance: $15,224.65
Year 4: Interest: $688.59, Principal: $7,392.21, Balance: $7,832.44
Year 5: Interest: $248.25, Principal: $7,832.55, Balance: -$0.11
Final Payment: $673.29
Example 2:
Loan: $76,000.00
Rate: 4%
Term: 6 years
Payment: $1,189.03
Year 1: Interest: $2,831.83, Principal: $11,436.53, Balance: $64,563.47
Year 2: Interest: $2,365.89, Principal: $11,902.47, Balance: $52,661.00
Year 3: Interest: $1,880.98, Principal: $12,387.38, Balance: $40,273.62
Year 4: Interest: $1,376.30, Principal: $12,892.06, Balance: $27,381.56
Year 5: Interest: $851.04, Principal: $13,417.32, Balance: $13,964.24
Year 6: Interest: $304.41, Principal: $13,963.95, Balance: $0.29
Final Payment: $1,189.32
Introduction
The program AMORT calculates:
* The monthly payment of a loan.
* An amortization table where the year's interest and principal is calculated.
* The amount of the final payment based on the balance.
Assumptions:
* Payments are made at the end of the month.
* The payment and the amount of interest calculated at each month are rounded to the nearest two decimal places. Not every one in finance follows this practice, so you mileage may very.
HP 71B Program: AMORT
Code:
100 FIX 2
105 INPUT "LOAN $";L
110 INPUT "RATE? ";I
115 I=I/1200
120 INPUT "TERM? ";T
125 N=12*T
130 U=(1-(1+I)^(-N))/I
135 P=L/U
140 P=IP(100*P+.5)/100
145 DISP "PAYMENT= $";P
150 PAUSE
155 B=L
200 FOR Y=1 TO T
205 S=0
210 C=0
215 FOR K=1 TO 12
220 E=IP(100*B*I+.5)/100
225 S=S+E
230 A=P-E
235 C=C+A
240 B=B-A
245 NEXT K
255 DISP "YEAR ";Y @ PAUSE
265 DISP CHR$(28);"INT= $";S @ PAUSE
275 DISP CHR$(28);"PRN= $";C @ PAUSE
285 DISP "BALANCE= $";B @ PAUSE
295 NEXT Y
310 W=P+B
315 DISP "LAST PMT= $";W @PAUSE
320 STD
Notes:
* There is no rounding command in the HP 71B's programming language. Lines 140 and 220 has a formula for rounding results to two decimal places:
IP(100*n+.5)/100
* STD is floating point display mode (standard)
* CHR$(28) prints the capital Sigma character, "Σ"
Examples
Example 1:
Loan: $35,000.00
Rate: 5.8%
Term: 5 years
Payment: $673.40
Year 1: Interest: $1,866.54, Principal: $6,214.26, Balance: $28,785.74
Year 2: Interest: $1,496.37, Principal: $6,584.43, Balance: $22,201.31
Year 3: Interest: $1,104.14, Principal: $6,976.66, Balance: $15,224.65
Year 4: Interest: $688.59, Principal: $7,392.21, Balance: $7,832.44
Year 5: Interest: $248.25, Principal: $7,832.55, Balance: -$0.11
Final Payment: $673.29
Example 2:
Loan: $76,000.00
Rate: 4%
Term: 6 years
Payment: $1,189.03
Year 1: Interest: $2,831.83, Principal: $11,436.53, Balance: $64,563.47
Year 2: Interest: $2,365.89, Principal: $11,902.47, Balance: $52,661.00
Year 3: Interest: $1,880.98, Principal: $12,387.38, Balance: $40,273.62
Year 4: Interest: $1,376.30, Principal: $12,892.06, Balance: $27,381.56
Year 5: Interest: $851.04, Principal: $13,417.32, Balance: $13,964.24
Year 6: Interest: $304.41, Principal: $13,963.95, Balance: $0.29
Final Payment: $1,189.32