Money Analyzer 1

Date: 1982
Type: Cassette
Platform(s): TS 1000
Tags: Finance

Money Analyzer 1 is a two-part financial calculation suite covering loan repayment schedules and savings projections. The loans section accepts a principal amount and annual interest rate in decimal form, then displays either a single-payment accrual table (2 to 40 months in steps of 2) or a monthly-payment amortization schedule (6 to 120 months in steps of 6), using the standard compound-interest formula. The savings section can either project a balance forward given a current balance, monthly contribution, interest rate, and time horizon, or work in reverse—given a savings goal, time frame, and current balance, it iterates over interest rates from 5% to 24% to show the required monthly deposit at each rate. SCROLL is used throughout to push results up the screen one line at a time, creating a continuous scrolling table effect.


Program Analysis

Program Structure

The listing contains two independent programs. The first handles loan analysis; the second (beginning with line 1 SLOW) handles savings planning. Each program is self-contained with its own line numbering starting at 10.

Loans Program

Lines 1030 initialize display-coordinate constants (C=3, D=5, E=20) used throughout PRINT AT statements to avoid magic numbers. Lines 100170 prompt the user for the loan type (S/M), principal (P), and annual interest rate in decimal form (I). The key branch at line 175 routes to either the single-payment path (line 300) or the monthly-payment path (line 180).

  • Monthly payment path (lines 180–250): Iterates N from 6 to 120 in steps of 6. Line 210 computes the standard annuity payment: A = P * J * I / (12 * (J-1)) where J = (1 + I/12)^N. Rounding is done via INT(.5 + 100*value)/100.
  • Single-payment path (lines 300–340): Iterates N from 2 to 40 in steps of 2. Line 310 computes the lump-sum payoff: F = P * (1 + I/12)^N, again rounded to two decimal places.

Both paths use SCROLL before each PRINT AT 21 to create a continuously scrolling results table. The program ends without an explicit STOP after line 340 in the single-payment branch, though the monthly branch uses GOTO 350 which targets a non-existent line—a deliberate halt technique.

Savings Program

Line 1 SLOW sets display mode. Lines 1030 replicate the same coordinate constants. Line 120 branches on an immediate INKEY$ check (after PAUSE 40000) to either the projection path or the goal-solving path.

  • Projection path (lines 130–250): Collects current balance (P), monthly savings (A), annual interest rate (I), and years (Y). Line 182 precomputes the monthly rate G=I/12. Line 210 applies the future-value-of-annuity formula: F = P*(1+G)^N + A*((1+G)^N - 1)/G, printed every 3 months. GOTO 430 targets a non-existent line to halt.
  • Goal-solving path (lines 300–420): Collects a target balance (G), years to goal (Y), and current balance (P). It then iterates annual interest rates from 5% to 24% in 1% steps, computing the required monthly deposit at each rate using: A = I*(G - P*J) / (12*(J-1)) where J = (1+I/12)^(Y*12). This inverse annuity calculation is the most mathematically sophisticated part of the suite.

Key BASIC Idioms and Techniques

TechniqueLocationPurpose
Coordinate constants C, D, ELines 10–30 (both programs)Reduce repetition in PRINT AT calls
INT(.5 + 100*value)/100Lines 210, 310, 390, 210 (savings)Round to two decimal places
SCROLL + PRINT AT 21Lines 220–230, 320–330, etc.Scrolling table display without clearing screen
PAUSE 40000 before INKEY$Lines 120/115 (loans), 115 (savings)Efficient keypress wait idiom
** exponentiationLines 200, 210, 310, 380, 390, 210 (savings)Compound interest calculations
GOTO to non-existent lineLines 250 (loans), 250 (savings)Program halt technique

Notable Anomalies

In the loans program, S$ is captured at line 130 after a PAUSE at line 120, but the PAUSE and INKEY$ are on separate lines rather than combined. Because PAUSE 40000 terminates on any keypress, INKEY$ on the following line may return an empty string if the key was released before line 130 executes—meaning the branch at line 175 would fall through to the monthly path regardless of user intent. The savings program avoids this by testing INKEY$ directly within the IF at line 120, immediately after the PAUSE.

The savings goal-solver at line 390 does not guard against division by zero when J=1 (which would occur if Y=0), nor does it handle negative results for A when the current balance already exceeds the goal. These are edge cases that the program assumes the user will avoid through correct input.

Content

Appears On

Related Products

Two programs: Savings, Loans. Savings: Analyze your savings plan, establish goals, and determine how best to attain them. Loans: Figure...

Related Articles

Related Content

Image Gallery

Source Code

  10 LET C=3
  20 LET D=5
  30 LET E=20
 100 PRINT AT 0,12;"LOANS";AT 1,12;"▀▀▀▀▀"
 110 PRINT AT C,C;"SINGLE OR MONTHLY PAY-OFF?"
 115 PRINT AT D,12;"(S/M)"
 120 PAUSE 40000
 130 LET S$=INKEY$ 
 140 PRINT AT C,C;"   INPUT AMOUNT TO BORROW   "
 145 PRINT AT D,12;"     "
 150 INPUT P
 160 PRINT AT C,D;" INPUT INTEREST RATE     "
 165 PRINT AT D,9;"(DECIMAL FORM)"
 170 INPUT I
 175 IF S$="S" THEN GOTO 300
 180 PRINT AT E,D;"MONTHS";AT E,19;"PAYMENTS"
 190 FOR N=6 TO 120 STEP 6
 200 LET J=(1+(I/12))**N
 210 LET A=(INT (.5+(100*P*J*I/(12*(J-1)))))/100
 220 SCROLL
 230 PRINT AT 21,7;N;AT 21,19;"$";A
 240 NEXT N
 250 GOTO 350
 300 PRINT AT 20,D;"MONTHS";AT 20,19;"PAY-OFF"
 305 FOR N=2 TO 40 STEP 2
 310 LET F=(INT (.5+(P*100*(1+(I/12))**N)))/100
 320 SCROLL
 330 PRINT AT 21,7;N;AT 21,19;"$";F
 340 NEXT N
 
   1 SLOW
  10 LET C=3
  20 LET D=5
  30 LET E=20
 100 PRINT AT 0,8;"SAVINGS PLAN"
 110 PRINT AT C,D;"DO YOU HAVE A GOAL?"
 115 PAUSE 40000
 120 IF INKEY$ ="Y" THEN GOTO 300
 130 PRINT AT C,D;" INPUT CURRENT BALANCE"
 140 INPUT P
 150 PRINT AT C,D;" INPUT MONTHLY SAVINGS"
 160 INPUT A
 170 PRINT AT C,D;" INPUT INTEREST RATE  "
 180 INPUT I
 182 LET G=I/12
 185 PRINT AT C,D;" INPUT NUMBER OF YEARS"
 186 INPUT Y
 190 PRINT AT E,C;"MONTH";AT E,19;"BALANCE"
 200 FOR N=3 TO 12*Y STEP 3
 210 LET F=(INT ((P*(1+G)**N+A*(((1+G)**N-1)/G))*100+.5))/100
 220 SCROLL
 230 PRINT AT 21,4;N;AT 21,19;"$";F
 240 NEXT N
 250 GOTO 430
 300 PRINT AT C,D;" INPUT AMOUNT OF GOAL"
 310 INPUT G
 320 PRINT AT C,D;" INPUT YEARS TO GOAL "
 330 INPUT Y
 340 PRINT AT C,D;" INPUT CURRENT BALANCE"
 350 INPUT P
 360 PRINT AT E,C;"INTEREST";AT E,19;"MONTHLY"
 370 FOR I=.05 TO .24 STEP .01
 380 LET J=(1+I/12)**(Y*12)
 390 LET A=(INT (I*100*(G-P*J)/(12*(J-1))+.5))/100
 400 SCROLL
 410 PRINT AT 21,D;I;AT 21,19;"$";A
 420 NEXT I

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

People

No people associated with this content.

Scroll to Top