This program is a comprehensive household finance calculator covering investments, loans, and depreciation, organized into a menu-driven structure with seven investment sub-options and six loan sub-options. It uses user-defined functions (DEF FN) for rounding to arbitrary precision and for formatting currency strings with trailing zeros. The loan amortization schedule section iterates month-by-month, accumulating interest and principal paid per year and displaying running totals across multiple screen pages with a pagination mechanism. Interest-rate solving for loans and investments uses a binary-search (bisection) iteration rather than a closed-form solution, converging when the result is within $0.005 of the target. Depreciation calculations support straight-line, sum-of-years-digits, and double-declining-balance methods, including a side-by-side comparison mode, with method dispatch implemented via computed GO SUB.
Program Structure
The program is organized as a four-section application launched from a main menu at line 200. Navigation uses a character input (A$) to branch between the four top-level modes:
- Investments (lines 270–1930): seven sub-options selected by number
- Loans (lines 2170–3940): six sub-options selected by number
- Depreciation (lines 7000–7208): five sub-options selected by number
- Save (line 9998): saves the program and returns to menu
A shared input subroutine at line 3950 reads values into the array V(8), where each element corresponds to a financial variable (e.g., future value, present value, interest rate, years, periods). The global variable C acts as a cursor into this array, incremented before each input call. The variable E records which slot the user marked as unknown by entering "X".
Variable Array and Input Convention
All financial parameters are stored in a single 8-element array V(). The string V$="TPIYMNDW" appears to document the intended mapping of array slots:
| Index | Mnemonic | Typical Use |
|---|---|---|
| V(1) | T / Future Value | Future or total value |
| V(2) | P / Principal | Present value or principal |
| V(3) | I / Interest Rate | Annual rate (stored as decimal) |
| V(4) | Y / Years | Whole years of term |
| V(5) | M / Months | Remaining months of term |
| V(6) | N / Periods | Compounding periods per year |
| V(7) | D / Deposit/Payment | Regular payment or deposit amount |
| V(8) | W / Withdrawal | Periodic withdrawal amount |
The subroutine at line 3950 handles three special inputs: blank (keep existing value), "MR" (recall memory register M), and "X" (mark this slot as the unknown to solve). Interest rate input is automatically divided by 100 when C=3 (line 4150), so the user enters a percentage.
User-Defined Functions
Four DEF FN functions are defined at lines 50–65:
FN A(X)— roundsXtoKdecimal places (whereKis set to 100 in the depreciation section, giving 2 d.p.).FN A$(X,C$)— formats a numeric stringC$with".00"if the value is a whole number, or appends"0"if only one decimal digit is present.FN Z(Z)— roundsZto 2 decimal places unconditionally.FN Z$(Z,Z$)— same currency string formatter asFN A$but using theZ/Z$naming convention used in the amortization section.
The duplication of FN A/FN A$ and FN Z/FN Z$ reflects the two separate contexts (depreciation and amortization) that need aligned decimal formatting.
Financial Computation Techniques
Closed-form expressions are used wherever the unknown is directly solvable. For example, future value at line 600 uses V(2)*(1+V(3)/V(6))↑(V(6)*Y), and the principal amount at line 1700 uses the standard present-value-of-annuity formula. When the interest rate is the unknown, however, no closed form exists, so a bisection search is used:
- Initialize
V(3)=0.99(99%) as the upper bound. - Compute the formula result
TorPorR. - Halve the step size:
TE = ABS(V(3)-I)/2. - Adjust
V(3)up or down byTEdepending on whether the result overshoots or undershoots. - Repeat until the error is less than $0.005.
This pattern appears at lines 1150–1270 (future value with deposits), 1730–1840 (withdrawal of funds), and 2560–2680 (regular loan payments). The convergence criterion of ABS(...) < .005 is appropriate for currency rounded to the nearest cent.
Logarithmic identities using 0.4342945 (≈ log₁₀(e)) convert natural-log expressions to base-10 equivalents in VAL strings, notably for solving for the time variable V(4).
VAL String Idiom
Many computed assignments use LET V(x) = VAL "expression" rather than writing the expression directly. This is a well-known memory optimization: the BASIC interpreter stores VAL "..." more compactly than an equivalent inline numeric expression, reducing the program’s RAM footprint.
Loan Amortization Schedule
The amortization section (lines 3230–3940) is the most complex part of the program. It iterates over years in an outer loop (FOR X=1 TO L1) and months within each year in an inner loop (FOR J=1 TO V(6)-N+1). Key features include:
- A payment counter
N5tracks total payments made; when it reachesNP(total number of payments), the final payment is set to the remaining balancePP=Pand flagF=1is set. - Per-year totals for interest (
I1) and principal (P1) are accumulated, then printed at year-end along with cumulative totals (H1,H2). - A pagination counter
C5triggers a screen clear and header reprint every 13 lines (line 3700). - Right-aligned currency columns are produced by the subroutine at line 5500, which uses a 9-character
DIM K$, converts the number to a string, left-pads with spaces, and ensures two decimal places.
Depreciation Section
The depreciation module (starting at line 7016) supports three methods via a computed GO SUB at line 7090:
| Option X | Method | Subroutine | Line |
|---|---|---|---|
| 1 | Straight-line | GO SUB 7025 | 7025 |
| 2 | Sum-of-years-digits | GO SUB 7030 | 7030 |
| 3 | Double-declining-balance | GO SUB 7035 | 7035 |
The computed dispatch is GO SUB (20+5*X)+7000, yielding 7025, 7030, or 7035 for X=1,2,3. Option 4 (compare all methods) calls all three subroutines explicitly in line 7140. The double-declining method switches formula mid-lifetime at year T = INT((L+1)/2)+1 (line 7090), transitioning from the accelerated formula to a straight-line residual (line 7038).
Display and Screen Handling
The program uses PRINT AT row,col; extensively to update individual fields on-screen without clearing the whole display, giving a form-filling appearance. The status bar at row 21 is used for messages like " C A L C U L A T I N G ". The POKE 23609,60 at line 201 sets the keyboard repeat delay, and POKE 23658,8 enables CAPS LOCK so that letter inputs work without holding SHIFT. The continue/copy prompt at line 5350–5380 checks for "Z" to trigger a COPY (printer dump) before pausing.
Anomalies and Minor Issues
- Line 5340 is referenced by line 6240 (
GO SUB 5340) but the actual subroutine for “continue” prompting is at line 5350. Line 5340 does not exist in the listing, so thisGO SUBfalls through to 5350 — a non-existent target used as a deliberate near-miss technique. - Line 5090 (
GO SUB 5090) is used to print the future value result; however, the actualPRINTstatement for future value is at line 5100, with line 5090 being an unlisted entry point that falls into 5100. Similarly lines 5120 and 5130, 5150 and 5160 follow this pattern. - The variable
C$is initialized at line 120 as"VSHR"(for the calculator’s memory operations), but is also used as a local variable insideFN A$(line 55), which shadows the global string. This does not cause a runtime error becauseDEF FNparameters are locally scoped. - The typo
"YOUR CHOISE:"(line 220) anda(lowercase) in line 2310 (a>7) are present in the original listing. - Lines 5100, 5130, and 5160 begin with a bare
PRINT 'which prints a blank line before the result — a minor formatting choice that creates visual separation.
Source Code
3 REM HOUSEHOLD FINANCE CALCULATOR FOR TS/ 2068
4 REM PRESENTED BYALGIS E. GEDRIS355 ROYAL OAK BLVD.RICHMOND HEIGHTS, OHIO44143-1709(216)481-8205
50 DEF FN A(X)= INT (K*X+0.5)/K
55 DEF FN A$(X,C$)=C$+(".00" AND X= INT X)+("0" AND ("0"+C$)(LEN C$)=".")
60 DEF FN Z(Z)= INT (100*Z+.5)/100
65 DEF FN Z$(Z,Z$)=Z$+(".00" AND Z= INT Z)+("0" AND ("0"+Z$)(LEN Z$)=".")
100 DIM V(8)
110 LET V$="TPIYMNDW"
120 LET C$="VSHR"
130 LET G$="M+M-M*M/MRMC"
140 LET Q$=""
190 LET M=0:LET NE=M:LET E=M:LET F1=M:LET L1=M
200 CLS :BORDER 2:PAPER 6:CLS :INK NOT PI
201 POKE 23609,60
202 POKE 23658,8
210 PRINT '" PRESENTED BY: ALGIS E. GEDRIS"''" HOUSEHOLD FINANCE CALCULATOR"
211 PRINT " _____________________________"
212 PRINT INK 2'' TAB 25;">ENTER<"
213 PRINT " 1. INVESTMENTS .......... I"
215 PRINT '" 2. LOANS ................ L"
217 PRINT '" 3. DEPRECIATION ......... D"
219 PRINT '" 4. SAVE ................. S"
220 PRINT INK 2''' TAB 10;"YOUR CHOISE:"
230 INPUT "INVESTMENT (I) / LOAN (L)"'"DEPRECIATION (D) / SAVE (S):";A$
240 IF A$="I" THEN GO TO 270
250 IF A$="L" THEN GO TO 2170
253 IF A$="D" THEN GO TO 7000
255 IF A$="S" THEN GO TO 9998
260 GO TO 230
270 CLS
280 PRINT "INVESTMENTS:"
281 PRINT "____________"
290 PRINT
300 PRINT "1) FUTURE VALUE WITH PERIODIC INTEREST."
310 PRINT "2) FUTURE VALUE WITH INTEREST COMPOUNDED CONTINUOUSLY."
320 PRINT "3) FUTURE VALUE WITH REGULAR DEPOSITS."
330 PRINT "4) FUTURE VALUE WITH CASH FLOWS."
340 PRINT "5) WITHDRAWAL OF FUNDS."
350 PRINT "6) NET PRESENT VALUE."
370 PRINT "7) RETURN TO MAIN MENU."
390 PRINT ' INK 2;"CHOICE:"
391 PRINT AT 18,0;"NOTE:"'"ENTER "; INK 2;"""X"""; INK 0;" FOR THE VARIABLE TO BESOLVED. APPLIES ONLY TO THE"'"VARIABLES PRECEDING WITH "; INK 2;"""*"""; INK 0;"."
400 INPUT A$
410 LET A= VAL (A$)
420 IF (A<1) OR (A>7) THEN GO TO 400
440 IF A=1 THEN GO TO 470
441 IF A=2 THEN GO TO 730
442 IF A=3 THEN GO TO 970
443 IF A=4 THEN GO TO 1360
444 IF A=5 THEN GO TO 1550
445 IF A=6 THEN GO TO 1940
447 IF A=7 THEN GO TO 200
470 CLS
480 PRINT "1) FUTURE VALUE WITH PERIODIC INTEREST"
490 PRINT
500 GO SUB 4710
501 PRINT AT 3,16;V(C),
510 GO SUB 4750
511 PRINT AT 4,16;V(C),
520 PRINT "*";
530 GO SUB 4840
531 PRINT AT 5,16;V(C)*100,
540 PRINT "*";
550 GO SUB 4880
551 PRINT AT 6,16;V(4),
560 IF E=4 THEN GO TO 580
570 GO SUB 4920
572 PRINT AT 7,16;V(5),
580 GO SUB 4970
581 IF E=4 THEN PRINT AT 7,16;V(C),:GO TO 590
582 PRINT AT 8,16;V(6),
590 IF E <>1 THEN GO TO 620
600 LET V(1)= VAL "INT (V(2)*(1+V(3)/V(6))↑(V(6)*Y)*100+.5)/100"
610 GO SUB 5090
620 IF E <>2 THEN GO TO 650
630 LET V(2)= VAL "INT (V(1)/((1+V(3)/V(6))↑(V(6)*Y))*100+.5)/100"
640 GO SUB 5120
650 IF E <>3 THEN GO TO 680
660 LET V(3)= VAL "INT ((V(6)*(V(1)/V(2))↑(1/(V(6)*Y))-V(6))*10000+.5)/10000"
670 GO SUB 5150
680 IF E <>4 THEN GO TO 710
690 LET V(4)= VAL ".4342945* LN (V(1)/V(2))/(V(6)*.4342945* LN (1+V(3)/V(6)))"
700 GO SUB 5180
710 GO SUB 5330
720 GO TO 270
730 CLS
740 PRINT "2) FUTURE VALUE WITH INTEREST COMPOUNDED CONTINUOUSLY."
750 PRINT
760 GO SUB 4710
761 PRINT AT 3,16;V(C),
770 GO SUB 4750
771 PRINT AT 4,16;V(C),
780 PRINT "*";
790 GO SUB 4840
791 PRINT AT 5,16;V(C)*100,
800 PRINT "*";
810 GO SUB 4880
811 PRINT AT 6,16;V(C),
820 IF E=4 THEN GO TO 840
830 GO SUB 4920
831 PRINT AT 7,16;V(C),
840 IF E <>1 THEN GO TO 870
850 LET V(1)= INT (V(2)* EXP (V(3)*Y)*100+.5)/100
860 GO SUB 5090
870 IF E <>2 THEN GO TO 900
880 LET V(2)= INT (V(1)/ EXP (V(3)*Y)*100+.5)/100
890 GO SUB 5120
900 IF E <>3 THEN GO TO 930
910 LET V(3)= VAL "INT (.4342945* LN (V(1)/V(2))/Y*10000+.5)/10000"
920 GO SUB 5150
930 IF E <>4 THEN GO TO 710
940 LET V(4)= VAL "INT (.4342945* LN (V(1)/V(2))/V(3)*100+.5)/100"
950 GO SUB 5180
960 GO TO 710
970 CLS
980 PRINT "3) FUTURE VALUE WITH REGULAR DEPOSITS."
990 PRINT
1000 GO SUB 4710
1001 PRINT AT 3,16;V(C),
1010 PRINT "*REG DEPOSITS $",
1020 LET C=6
1030 GO SUB 3950
1031 PRINT AT 4,16;V(C),
1040 PRINT "*";
1050 GO SUB 4840
1051 PRINT AT 5,16;V(C)*100,
1060 PRINT "*";
1070 GO SUB 4880
1071 PRINT AT 6,16;V(C),
1080 IF E=4 THEN GO TO 1100
1090 GO SUB 4920
1091 PRINT AT 7,16;V(C),
1100 GO SUB 4970
1101 IF E=4 THEN PRINT AT 7,16;V(C),:GO TO 1104
1102 PRINT AT 8,16;V(C),
1104 PRINT
1110 IF E <>1 THEN GO TO 1140
1120 LET V(1)= VAL "INT (V(7)*V(6)*((1+V(3)/V(6))↑(V(6)*Y)-1)/V(3)*100+.5)/100"
1130 GO SUB 5090
1140 IF E <>3 THEN GO TO 1280
1150 LET V(3)=.99
1160 LET I=0
1170 LET T= VAL "INT (V(7)*(((1+V(3)/V(6))↑(V(6)*Y)-1)/(V(3)/V(6)))*100+.5)/100"
1180 LET TE= ABS (V(3)-I)/2
1190 LET I=V(3)
1200 IF ABS (T-V(1))<.005 THEN GO TO 1260
1210 IF T<V(1) THEN GO TO 1240
1220 LET V(3)=V(3)-TE
1230 GO TO 1170
1240 LET V(3)=V(3)+TE
1250 GO TO 1170
1260 LET V(3)= INT (V(3)*10000+.5)/10000
1270 GO SUB 5150
1280 IF E <>4 THEN GO TO 1310
1290 LET V(4)= VAL ".4342945* LN (V(3)*V(1)/(V(6)*V(7))+1)/(V(6)*.4342945* LN (1+V(3)/V(6)))"
1300 GO SUB 5180
1310 IF E <>7 THEN GO TO 710
1320 LET V(7)= VAL "INT (V(1)*(V(3)/V(6))/((1+V(3)/V(6))↑(V(6)*Y)-1)*100+.5)/100"
1330 PRINT
1340 PRINT "DEPOSITS REQD $",V(7)
1350 GO TO 710
1360 CLS
1370 PRINT "4) FUTURE VALUE WITH CASH FLOWS."
1380 PRINT
1390 GO SUB 4840
1391 PRINT AT 2,16;V(C)*100,
1400 GO SUB 4880
1401 PRINT AT 3,16;V(C),
1410 PRINT "CASH FLOW (+/-)"
1420 PRINT
1430 LET V(1)=0
1440 FOR I=1 TO V(4)
1450 PRINT "CASH FLOW-YEAR #";I
1460 INPUT A$
1461 PRINT AT I+5,19;A$,
1470 LET A= VAL (A$)
1480 LET V(1)=V(1)+A*(1+V(3))↑(V(4)-I)
1490 NEXT I
1500 LET V(1)= INT (V(1)*100+.5)/100
1510 GO SUB 5090
1520 LET TE=V(1)
1530 GO SUB 5270
1540 GO TO 710
1550 CLS
1560 PRINT "5) WITHDRAWAL OF FUNDS "
1570 PRINT
1580 GO SUB 4750
1581 PRINT AT 2,16;V(C),
1590 PRINT "*REG WITHDRW $",
1600 LET C=7
1610 GO SUB 3950
1611 PRINT AT 3,16;V(C),
1620 PRINT "*";
1630 GO SUB 4840
1631 PRINT AT 4,16;V(C)*100,
1640 PRINT "*";
1650 GO SUB 4880
1651 PRINT AT 5,16;V(C),
1670 GO SUB 4920
1671 PRINT AT 6,16;V(C),
1680 GO SUB 4970
1681 IF E=4 THEN PRINT AT 6,16;V(C),:GO TO 1690
1682 PRINT AT 7,16;V(C),:PRINT
1690 IF E <>2 THEN GO TO 1720
1700 LET V(2)= VAL "INT (V(8)*V(6)/V(3)*(1-(1+V(3)/V(6))↑(-V(6)*Y))*100+.5)/100"
1710 GO SUB 5120
1720 IF E <>3 THEN GO TO 1860
1730 LET V(3)=.99
1740 LET I=0
1750 LET R= VAL "INT (V(2)*V(3)/V(6)*(1/((1+V(3)/V(6))↑(V(6)*Y)-1)+1)*100+.5)/100"
1760 LET TE= ABS (V(3)-I)/2
1770 LET I=V(3)
1780 IF ABS (R-V(8))<.005 THEN GO TO 1840
1790 IF R<V(8) THEN GO TO 1820
1800 LET V(3)=V(3)-TE
1810 GO TO 1750
1820 LET V(3)=V(3)+TE
1830 GO TO 1750
1840 LET V(3)= INT (V(3)*10000+.5)/10000
1850 GO SUB 5150
1860 IF E <>4 THEN GO TO 1890
1870 LET V(4)= VAL ".4342945* LN (V(6)*V(8)/(V(6)*V(8)-V(3)*V(2)))/(V(6)*.4342945* LN (1+V(3)/V(6)))"
1880 GO SUB 5180
1890 IF E <>8 THEN GO TO 710
1900 LET V(8)= VAL "INT (V(2)*V(3)/V(6)*(1/((1+V(3)/V(6))↑(V(6)*Y)-1)+1)*100+.5)/100"
1910 PRINT
1920 PRINT "REG WITHDRAW :$",V(8)
1930 GO TO 710
1940 CLS
1950 PRINT "6) NET PRESENT VALUE"
1960 PRINT
1970 PRINT "INIT INVEST $",
1980 LET C=1
1990 GO SUB 3950
1991 PRINT AT 2,16;V(C),
2000 GO SUB 4840
2001 PRINT AT 3,16;V(C)*100,
2010 GO SUB 4880
2011 PRINT AT 4,16;V(C),
2020 PRINT "CASH FLOW(+/-)"
2030 PRINT
2040 LET NV=-V(2)
2050 FOR I=1 TO V(4)
2060 PRINT "CASH FLOW-YR #",I
2070 INPUT A$
2071 PRINT AT I+6,19;A$
2080 LET A= VAL A$
2090 LET NV=NV+A/((V(3)+1)↑I)
2100 NEXT I
2110 LET NV= INT (NV*100+.5)/100
2120 PRINT
2130 PRINT "PRESENT VALUE:$",NV
2140 LET TE=NV
2150 GO SUB 5270
2160 GO TO 710
2170 CLS
2180 PRINT ''';"LOAN CALCULATIONS:":PRINT OVER 1; AT 3,0;"__________________";''
2200 PRINT "1) REGULAR LOAN PAYMENTS."
2210 PRINT "2) REMAINING LOAN LIABILITY."
2220 PRINT "3) FINAL LOAN PAYMENT."
2230 PRINT "4) SINGLE LOAN PAYMENT."
2240 PRINT "5) LOAN AMORTIZATION SCHEDULE."
2261 PRINT "6) LOAN CALCULATIONS"
2262 PRINT "7) RETURN TO MAIN MENU."
2270 PRINT
2280 PRINT INK 2;"CHOICE: "
2281 PRINT AT 18,0;"NOTE:",,"ENTER "; INK 2;"""X"""; INK 0;" FOR THE VARIABLE TO BESOLVED. APPLIES ONLY TO THE","VARIABLES PRECEDING WITH "; INK 2;"""*"""; INK 0;"."
2290 INPUT A$
2300 LET A= VAL A$
2310 IF A<1 OR a>7 THEN GO TO 2290
2330 IF A=1 THEN GO TO 2360
2331 IF A=2 THEN GO TO 2780
2332 IF A=3 THEN GO TO 2960
2333 IF A=4 THEN GO TO 3120
2334 IF A=5 THEN GO TO 3230
2336 IF A=6 THEN GO TO 6000
2338 IF A=7 THEN GO TO 200
2360 CLS
2370 PRINT "1) REGULAR LOAN PAYMENTS"
2380 PRINT
2390 PRINT "*";
2400 GO SUB 4790
2401 PRINT AT 2,16;V(C),
2410 PRINT "*";
2420 GO SUB 5010
2421 PRINT AT 3,16;V(C),
2430 PRINT "*";
2440 GO SUB 4840
2441 PRINT AT 4,16;V(C)*100,
2450 PRINT "*";
2460 GO SUB 4880
2461 PRINT AT 5,16;V(C),
2470 IF E=4 THEN GO TO 2490
2480 GO SUB 4920
2481 PRINT AT 6,16;V(C),
2490 GO SUB 4970
2491 IF E=4 THEN PRINT AT 6,16;V(C),:GO TO 2500
2492 PRINT AT 7,16;V(C),
2500 IF E <>2 THEN GO TO 2550
2510 LET V(2)= VAL "INT (V(7)*V(6)/V(3)*(1-(1+V(3)/V(6))↑(-V(6)*Y))*100+.5)/100"
2520 PRINT
2530 PRINT "AMT OF PRINC:$",V(2)
2540 GO TO 2760
2550 IF E <>3 THEN GO TO 2690
2560 LET V(3)=.99
2570 LET I=0
2580 LET P= VAL "INT (V(7)*V(6)/V(3)*(1-((1+V(3)/V(6))↑(-V(6)*Y)))*100+.5)/100"
2590 LET TE= ABS (V(3)-I)/2
2600 LET I=V(3)
2610 IF ABS (P-V(2))<.005 THEN GO TO 2670
2620 IF P<V(2) THEN GO TO 2650
2630 LET V(3)=V(3)+TE
2640 GO TO 2580
2650 LET V(3)=V(3)-TE
2660 GO TO 2580
2670 LET V(3)= INT (V(3)*10000+.5)/10000
2680 GO SUB 5150
2690 IF E <>4 THEN GO TO 2720
2700 LET V(4)= VAL "-.4342945* LN (1-V(3)*V(2)/(V(6)*V(7)))/(V(6)*.4342945* LN (V(3)/V(6)+1))"
2710 GO SUB 5180
2720 IF E <>7 THEN GO TO 2760
2730 LET V(7)= VAL "INT (V(3)*V(2)/(V(6)*(1-(V(3)/V(6)+1)↑(-V(6)*Y)))*100+.5)/100"
2740 PRINT
2750 PRINT "REQ PAYMENT: $",V(7)
2760 GO SUB 5330
2770 GO TO 2170
2780 CLS
2790 PRINT "2) REMAINING LOAN LIABILITY"
2800 PRINT
2810 GO SUB 4790
2811 PRINT AT 2,16;V(C),
2820 GO SUB 5010
2821 PRINT AT 3,16;V(C),
2830 GO SUB 4840
2831 PRINT AT 4,16;V(C)*100,
2840 GO SUB 4970
2841 PRINT AT 5,16;V(C),
2850 PRINT "LAST PAYMENT",,"# WAS:"
2860 INPUT A$
2870 LET A= VAL (A$)
2871 PRINT AT 7,16;A
2880 FOR J=1 TO A
2890 LET I= INT (P*V(3)/V(6)*100+.5)/100
2900 LET P=P+I-V(7)
2910 NEXT J
2920 LET LI= INT (P*100+.5)/100
2930 PRINT
2940 PRINT "REMAINING LOAN",,"AFTER >";A;"<"
2941 PRINT "PAYMENTS IS: $ ";LI
2950 GO TO 2760
2960 CLS
2970 PRINT "3) FINAL LOAN PAYMENT"
2980 PRINT
2990 GO SUB 4790
2991 PRINT AT 2,16;V(C),
3000 GO SUB 5010
3001 PRINT AT 3,16;V(C),
3010 GO SUB 4840
3011 PRINT AT 4,16;V(C)*100,
3020 GO SUB 5050
3021 PRINT AT 6,16;V(4),
3022 PRINT AT 7,16;V(5),
3030 GO SUB 4970
3031 PRINT AT 8,16;V(C),
3040 FOR J=1 TO V(6)*Y
3050 LET I= INT (P*V(3)/V(6)*100+.5)/100
3060 LET P=P+I-V(7)
3070 NEXT J
3080 LET LP= INT (P*100+.5)/100+V(7)
3090 PRINT
3100 PRINT "LAST PAYMENT:$",LP
3110 GO TO 2760
3120 CLS
3130 PRINT "4) SINGLE LOAN PAYMENT"
3140 PRINT
3150 GO SUB 4790
3151 PRINT AT 2,16;V(C),
3160 GO SUB 4840
3161 PRINT AT 3,16;V(C)*100,
3170 GO SUB 5050
3171 PRINT AT 5,16;V(4),
3172 PRINT AT 6,16;V(5),
3180 GO SUB 4970
3181 PRINT AT 7,16;V(C),
3190 LET V(1)= VAL "INT (V(2)*(1+V(3)/V(6))↑(Y*V(6))*100+.5)/100"
3200 PRINT
3210 PRINT "TOTAL OWED:$",V(1)
3220 GO TO 2760
3230 LET C5=0
3240 LET N5=0
3250 LET F=0
3260 LET P1=0
3270 LET I1=0
3280 CLS
3290 PRINT "5) LOAN AMORTIZATION SCHEDULE"
3300 PRINT
3305 LET H1=0:LET H2=0
3310 GO SUB 4790
3311 PRINT AT 2,16;V(C),
3320 GO SUB 5010
3321 PRINT AT 3,16;V(C),
3330 GO SUB 4840
3331 PRINT AT 4,16;V(C)*100,
3340 GO SUB 5050
3341 PRINT AT 6,16;V(4),
3342 PRINT AT 7,16;V(5),
3350 PRINT "# YR PAYMENTS",
3360 GO SUB 3950
3361 PRINT AT 8,16;V(C),
3370 PRINT "ENTER THE MONTH",,"# IN WHICH THE",,"LOAN BEGAN"
3371 PRINT AT 11,16;NE,
3380 INPUT N
3390 LET NE=N
3391 PRINT AT 11,16;NE,
3400 LET NP=(V(4)*12+V(5))/(12/V(6))
3410 LET NY= INT (((N-1)+NP)/V(6)+.99)
3420 PRINT "ENTER THE RANGE",,"OF YEARS YOU'D",,"LIKE TO EXAMINE",,"(FIRST, LAST)"
3421 PRINT AT 15,16;F1;" ";L1
3430 INPUT F1,L1
3431 PRINT AT 15,16;F1;" ";L1,
3432 PRINT AT 21,0;" C A L C U L A T I N G "
3440 IF L1 <=NY THEN GO TO 3460
3450 LET L1=NY
3460 FOR X=1 TO L1
3470 IF X<F1 THEN GO TO 3490
3480 GO SUB 5390
3490 FOR J=1 TO V(6)-N+1
3500 LET I= INT (P*V(3)/V(6)*100+.5)/100
3510 LET N5=N5+1
3520 LET PP=V(7)-I
3530 IF X <>NY THEN GO TO 3570
3540 IF N5 <>NP THEN GO TO 3570
3550 LET PP=P
3560 LET F=1
3570 IF X<F1 THEN GO TO 3600
3580 PRINT N5; TAB 5;
3581 LET Z=P:GO SUB 5500:PRINT K$; TAB 14;
3590 LET Z=PP:GO SUB 5500:PRINT K$; TAB 23;
3600 LET P=P+I-V(7)
3610 IF F=0 THEN GO TO 3640
3620 LET P=0
3630 LET J=V(6)
3640 IF X<F1 THEN GO TO 3670
3650 LET Z=I:GO SUB 5500:PRINT K$
3670 LET I1=I1+I
3680 LET P1=P1+PP
3690 LET C5=C5+1
3700 IF C5 <>13 THEN GO TO 3770
3710 IF X<F1 THEN GO TO 3770
3720 GO SUB 5330
3730 CLS
3740 LET C5=0
3750 IF J=V(6)-N+1 THEN GO TO 3770
3760 GO SUB 5390
3770 NEXT J
3780 IF X<F1 THEN GO TO 3890
3790 IF F=0 THEN GO TO 3820
3810 LET Z=PP+I:GO SUB 9000:PRINT "FINAL PAYMENT:$"; TAB 32- LEN Z$;Z$
3830 LET Z=I1:GO SUB 9000:PRINT "INT PAID IN ";X;" YR: $"; AT 18,32- LEN Z$;Z$
3840 LET Z=P1:GO SUB 9000:PRINT "PRINC PAID IN ";X;" YR: $"; TAB 32- LEN Z$;Z$
3841 LET H1=H1+I1:LET H2=H2+P1
3842 PRINT AT 21,0;" "
3844 LET Z=H1:GO SUB 9000:PRINT AT 20,0;"TOTAL INTEREST PAID: $"; TAB 32- LEN Z$;Z$
3849 LET Z=H2:GO SUB 9000:PRINT "TOTAL PRINCIPAL PAID: $"; TAB 32- LEN Z$;Z$
3850 IF F=1 THEN GO TO 3930
3860 IF X=L1 THEN GO TO 3930
3870 GO SUB 5330
3880 CLS
3890 LET C5=0
3900 LET P1=0
3910 LET I1=0
3920 LET N=1
3930 NEXT X
3940 GO TO 2760
3950 LET C=C+1
3960 IF C <>3 THEN GO TO 3990
3970 PRINT V(3)*100,
3980 GO TO 4000
3990 PRINT V(C),
4000 LET A$=""
4010 INPUT A$
4020 IF A$ <>"" THEN GO TO 4040
4030 RETURN
4040 IF A$ <>"MR" THEN GO TO 4100
4050 PRINT "MEM=";M;" USE AS VARIABLE HERE (Y/N)"
4060 INPUT A$
4070 IF A$="N" THEN GO TO 4000
4080 LET V(C)=M
4090 RETURN
4100 IF A$ <>"X" THEN GO TO 4130
4101 LET V(C)=0
4110 LET E=C
4120 RETURN
4130 LET V(C)= VAL (A$)
4140 IF C <>3 THEN GO TO 4160
4150 LET V(C)=V(C)/100
4160 RETURN
4710 PRINT "*FUTURE VALUE $",
4720 LET C=0
4730 GO SUB 3950
4740 RETURN
4750 PRINT "*PRESENT VALUE$",
4760 LET C=1
4770 GO SUB 3950
4780 RETURN
4790 PRINT "PRINCIPAL $",
4800 LET C=1
4810 GO SUB 3950
4820 LET P=V(C)
4830 RETURN
4840 PRINT "INT RATE %",
4850 LET C=2
4860 GO SUB 3950
4870 RETURN
4880 PRINT "FOR # OF YEARS",
4890 LET C=3
4900 GO SUB 3950
4910 RETURN
4920 PRINT "FOR # OF MONTHS",
4930 LET C=4
4940 GO SUB 3950
4950 LET Y=V(C-1)+V(C)/12
4960 RETURN
4970 PRINT "YRLY PERIODS #",
4980 LET C=5
4990 GO SUB 3950
5000 RETURN
5010 PRINT "PAYMENTS $",
5020 LET C=6
5030 GO SUB 3950
5040 RETURN
5050 PRINT "TERM OF LOAN:"
5060 GO SUB 4880
5070 GO SUB 4920
5080 RETURN
5100 PRINT '"FUTURE VALUE $",V(1)
5110 RETURN
5130 PRINT ''"REQD INVESTMT $",V(2)
5140 RETURN
5160 PRINT '"INT RATE REQD %",V(3)*100
5170 RETURN
5180 LET V(5)=V(4)- INT (V(4))
5190 LET V(5)= INT (INT (12*V(5)*10+.5)/10)
5200 LET V(4)= INT (V(4))
5210 IF V(5) <>12 THEN GO TO 5240
5220 LET V(4)=V(4)+1
5230 LET V(5)=0
5240 PRINT
5250 PRINT "# YRS & MONTHS:";V(4);" ; ";V(5)
5260 RETURN
5270 PRINT
5280 IF TE >=0 THEN GO TO 5310
5290 PRINT "THIS IS A LOSING INVESTMENT."
5300 RETURN
5310 PRINT "THIS IS A PROFITABLE INVESTMENT."
5320 RETURN
5350 LET A$=""
5360 INPUT "TO CONTINUE-"; INK 0;"ENTER"; INK 7;" COPY-"; INK 0;"COPY";A$
5361 IF A$="Z" THEN PRINT #1; AT 0,0,,:COPY
5362 PRINT #1; AT 0,0;" HIT <ENTER> TO CONTINUE. "
5370 IF A$ <>"" THEN GO TO 5350
5380 RETURN
5390 CLS
5400 PRINT INK 2; AT 21,0;" C A L C U L A T I N G "; INK 0; AT 0,0;"LOAN AMORTIZATION SCHEDULE FOR YEAR "; AT 1,15;X
5410 PRINT "PRINCIPAL $",V(2),"RATE %",V(3)*100;"%","PAYMENT $",V(7)
5430 PRINT " # BEG. BAL PRINC INT "
5460 RETURN
5500 LET Z= INT (Z*100+.5)/100:DIM K$(9):LET K$= STR$ Z
5501 IF K$(9)= CHR$ 32 THEN LET K$= CHR$ 32+K$( TO 9):GO TO 5501
5502 FOR G=1 TO 9
5503 IF K$(G)="." THEN GO TO 5505
5504 NEXT G
5505 IF G=10 THEN LET K$=K$(4 TO )+".00"
5506 IF G=8 THEN LET K$=K$(2 TO )+"0"
5507 RETURN
6000 CLS
6010 PRINT AT PI, PI;"LOAN CALCULATIONS"
6020 PRINT ''" SELLING PRICE:... $ ";
6025 INPUT SP:PRINT sp
6100 PRINT " DOWN PAYMENT:.... $ ";
6110 INPUT "CASH ";P$
6111 IF P$="" THEN GO TO 6150
6120 PRINT P$:LET DP= VAL P$
6125 GO TO 6200
6150 PRINT AT 7,2;"DOWNPAYMENT %$ ";
6152 INPUT "PERCENT DOWN: % ";DP
6153 PRINT DP
6155 LET DP=SP*(.01)*DP:LET DP= INT DP
6158 PRINT AT 7,22;DP
6200 PRINT '" NET LOAN:........ $"
6210 LET P=SP-DP:LET V(1)=P:LET C=1
6220 PRINT AT 9,22;P
6230 LET V(1)=P
6240 GO SUB 5340
6500 GO TO 2170
7016 BORDER 5:PAPER 3:LET K=100:CLS :BEEP .07,22:GO TO 7050
7020 LET Y= FN A(Y):LET C$= FN A$(Y, STR$ Y):RETURN
7025 LET D=(C-S)/L:RETURN
7030 LET D=2*(C-S)*(L+1-Z)/(L*(L+1)):RETURN
7035 IF Z<T THEN LET D=2*(C-S)/L*(1-2/L)↑(Z-1):RETURN
7038 LET D=((C-S)*(1-2/L)↑(T-1))/(L-T+1):RETURN
7050 CLS :PRINT PAPER 6; AT 2,2;" DEPRECIATION CALCULATIONS "; AT 6,10;" OPTIONS "; AT 8,5;"1. STRAIGHT - LINE "; AT 9,5;"2. SUM - OF - YEARS "; AT 10,5;"3. DOUBLE - DECLINING "; AT 11,5;"4. COMPARE METHODS "; AT 12,5;"5. RETURN TO MAIN MENU"
7052 INPUT "ENTER OPTION ( 1 - 5 ): ";X
7054 LET X= INT X:IF (X<1)+(X>5) THEN BEEP 1,-20:GO TO 7052
7056 PAPER 7:PRINT PAPER 6; AT 7+X,3;">>":PAUSE 100:CLS
7060 IF X=1 THEN PRINT PAPER 6;"1. STRAIGHT-LINE DEPRECIATION "
7062 IF X=2 THEN PRINT PAPER 6;"2. SUM-OF-YEARS DIGITS METHOD"
7064 IF X=3 THEN PRINT PAPER 6;"3. DOUBLE-DECLINING-BALANCE"
7066 IF X=4 THEN PRINT PAPER 6;"4. COMPARISON OF ALL METHODS"
7068 IF X=5 THEN GO TO 200
7070 PRINT ;"ORIGINAL COST: $ ";:INPUT C:PRINT C
7072 PRINT "SALVAGE VALUE: $ ";:INPUT S:PRINT S:IF (S >=C)+(S<0) THEN BEEP 1,-20:CLS :GO TO 7060
7074 PRINT "LIFETIME (YR): ";:INPUT L:LET L= ABS L:PRINT L
7076 IF X=4 THEN GO TO 7120
7080 PRINT INK 2; AT 21,0;" C A L C U L A T I N G "; AT 4,0;"YEAR DEPRECIATION BOOK VALUE "
7081 PRINT OVER 1, AT 4,0;"_______________________________"
7090 LET T= INT ((L+1)/2)+1:LET B=C:FOR Z=1 TO L:GO SUB (20+5*X)+7000
7095 LET B=B-D:LET Y=D:GO SUB 7020:LET D$=C$:LET Y=B:GO SUB 7020:LET B$=C$:PRINT TAB 2;Z;
7100 PRINT TAB 15- LEN D$;D$; TAB 29- LEN B$;B$:NEXT Z:GO TO 7200
7120 PRINT INK 2; AT 21,0;" C A L C U L A T I N G "; INK 0; AT 4,0;"YR STRAIGHT SUM-OF DOUBLE-":PRINT "# -LINE -YEARS DECLINING":PRINT OVER 1; AT 5,0;"________________________________"
7130 LET T= INT ((L+1)/2)+1
7140 FOR Z=1 TO L:GO SUB 7025:LET Y=D:GO SUB 7020:LET S$=C$:GO SUB 7030:LET Y=D:GO SUB 7020:LET B$=C$:GO SUB 7035:LET Y=D::GO SUB 7020:LET D$=C$:PRINT Z;
7150 PRINT TAB 11- LEN S$;S$; TAB 21- LEN B$;B$; TAB 31- LEN D$;D$
7160 NEXT Z
7200 PRINT AT 21,0;"TO CONTINUE "; INK 2;">ENTER<"; INK 0;"/ TO COPY "; INK 2;">Z<":LET A$="":INPUT A$
7205 IF A$="Z" THEN PRINT AT 21,0,,:COPY :PRINT AT 21,0;"TO CONTINUE HIT..."; INK 2;"<< ENTER >>";:INPUT A$:IF A$ <>"" THEN GO TO 7000
7208 GO TO 7000
9000 LET Z= FN Z(Z):LET Z$= FN Z$(Z, STR$ Z):RETURN
9989 STOP
9998 SAVE "HFC/2068" LINE 30:GO TO 200Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.
