This program calculates a recommended loan interest rate by scoring an applicant across eight weighted criteria: loan amount, repayment term, salary, job history, job security, credit rating, existing debts, and the prevailing prime interest rate. Each criterion contributes a penalty point value to a running total stored in variable I, and the final score maps to one of four interest rate bands: 14%, 17%, 19%, or 22%. Input values are echoed back to the screen immediately after each INPUT statement using a paired PRINT, a common ZX81/TS1000 idiom to confirm keyboard entry on the display. The branching logic uses a cascade of IF/GOTO statements rather than structured conditionals, with separate lines setting each sub-score variable (A1 through H1) before they are summed at line 840.
Program Analysis
Program Structure
The program is organised as a linear sequence of input-and-score blocks, one per financial criterion, followed by a summation and decision phase. Each block follows the same pattern: prompt, INPUT, echo PRINT, then a chain of IF/GOTO tests that branch to a line setting a sub-score variable, which then falls through or GOTOs the next block’s entry point.
- Lines 10–79: Loan amount (variable
A, score inA1) - Lines 80–179: Repayment term selection (variable
B, score inB1) - Lines 180–309: Applicant salary (variable
C, score inC1) - Lines 310–409: Number of jobs in last 5 years (variable
D, score inD1) - Lines 410–509: Job security rating (variable
E, score inE1) - Lines 510–639: Credit rating (variable
F, score inF1) - Lines 640–739: Other debts (variable
G, score inG1) - Lines 740–839: Prime interest rate (variable
H, score inH1) - Lines 840–1000: Summation, output, and STOP
Scoring Model
Each criterion contributes a penalty point value; higher points indicate higher risk. The eight sub-scores are summed into I at line 840. The total is then tested against three thresholds to select an interest rate:
| Score range | Interest rate |
|---|---|
| ≤ 33 | 14 PCT. |
| 34 – 59 | 17 PCT. |
| 60 – 99 | 19 PCT. |
| ≥ 100 | 22 PCT. |
The sub-score ranges for each criterion are summarised below:
| Criterion | Variable | Low penalty | High penalty |
|---|---|---|---|
| Loan amount | A1 | 6 (>5000) | 12 (≤5000) |
| Repayment term | B1 | 4 (12 mo) | 12 (24 mo) |
| Salary | C1 | 4 (≥20000) | 16 (zero) |
| Job count (5 yr) | D1 | 3 (1 job) | 15 (≥3 jobs) |
| Job security | E1 | 3 (excellent) | 12 (poor) |
| Credit rating | F1 | 4 (excellent) | 16 (none) |
| Other debts | G1 | 3 (none) | 12 (large) |
| Prime rate | H1 | 3 (<0.12) | 12 (≥0.15) |
Key BASIC Idioms
Every INPUT statement is immediately followed by a PRINT of the same variable (e.g. lines 30/31, 100/101). This is a standard idiom on this platform to redisplay the entered value on-screen after the INPUT line scrolls away, giving the user confirmation of what was typed.
The string "INTEREST RATE" is stored in Z$ at line 850 and reused across four PRINT statements (lines 930, 950, 970, 990), avoiding repetition of the literal string and saving a small amount of memory.
The prime interest rate input at line 750 expects a decimal fraction (e.g. .12 for 12%), while all other numeric inputs are integers. No validation or guidance on this convention is given to the user, which could cause confusion.
Notable Techniques and Anomalies
The conditional chain at lines 880–910 contains a logic gap: line 880 tests I<=33, line 890 tests I<60, and line 900 tests I<=99. The boundary between the first and second band is therefore 34–59 (exclusive of 60), but the boundary between the second and third bands is ambiguous: a score of exactly 60 falls through line 890’s test (since 60 is not <60) and is caught by line 900. This is consistent, but the asymmetric use of <= versus < could mislead a reader.
Line 830 carries the REM comment TOTAL UP POINTS but execution reaches line 840 directly regardless, since line 820 sets H1=6 and falls through. The REM at 830 is never branched to intentionally; it simply occupies space between the last H1 assignment and the summation line.
The cascade at lines 330–400 for job count has no ELSE or default: if D is zero or negative, none of the three IF tests match and D1 is never set, leaving it at its previous value or zero. Similarly, lines 430–500 for job security and 540–630 for credit rating can leave their variables unset if the user enters an out-of-range value, which would silently corrupt the total.
Line 1020 (LIST) is unreachable after the SAVE at line 1010 and the STOP at line 1000; it has no effect during normal execution.
Content
Source Code
5 REM %I%N%R%A%T%E%/%/%C%R%E%D%I%T% %R%A%T%I%N%G
10 PRINT
11 PRINT "CREDIT RATING INTEREST RATE"
12 PRINT
20 PRINT "ENTER LOAN AMOUNT"
30 INPUT A
31 PRINT A
40 IF A>5000 THEN GOTO 70
50 LET A1=12
60 GOTO 80
70 LET A1=6
80 PRINT "HOW MANY MONTHS NEEDED TO REPAY--12,18,24? ENTER 1,2 OR 3"
100 INPUT B
101 PRINT B
110 IF B<2 THEN GOTO 150
120 IF B<3 THEN GOTO 170
130 LET B1=12
140 GOTO 180
150 LET B1=4
160 GOTO 180
170 LET B1=8
180 PRINT "ENTER APPLICANT SALARY"
190 INPUT C
191 PRINT C
200 IF C=0 THEN GOTO 240
210 IF C<10000 THEN GOTO 260
220 IF C<20000 THEN GOTO 280
230 IF C>=20000 THEN GOTO 300
240 LET C1=16
250 GOTO 310
260 LET C1=12
270 GOTO 310
280 LET C1=8
290 GOTO 310
300 LET C1=4
310 PRINT "NR OF JOBS LAST 5 YEARS?"
320 INPUT D
321 PRINT D
330 IF D=1 THEN GOTO 360
340 IF D=2 THEN GOTO 380
350 IF D>=3 THEN GOTO 400
360 LET D1=3
370 GOTO 410
380 LET D1=6
390 GOTO 410
400 LET D1=15
410 PRINT "JOB SECURITY?--ANS 1=EXC,2=GOOD,OR 3=POOR"
420 INPUT E
421 PRINT E
430 IF E=1 THEN GOTO 460
440 IF E=2 THEN GOTO 480
450 IF E=3 THEN GOTO 500
460 LET E1=3
470 GOTO 510
480 LET E1=6
490 GOTO 510
500 LET E1=12
510 PRINT "CREDIT RATING--ENTER 1=EXC.,2=GOOD,3=POOR,0=NONE"
530 INPUT F
531 PRINT F
540 IF F=1 THEN GOTO 590
550 IF F=2 THEN GOTO 610
560 IF F=3 THEN GOTO 630
570 LET F1=12
580 GOTO 640
590 LET F1=4
600 GOTO 640
610 LET F1=8
620 GOTO 640
630 LET F1=16
640 PRINT "OTHER DEBTS--ENTER 1=NONE,2=LOW OR AVG.,3=LARGE."
650 INPUT G
651 PRINT G
660 IF G=1 THEN GOTO 690
670 IF G=2 THEN GOTO 710
680 IF G>2 THEN GOTO 730
690 LET G1=3
700 GOTO 740
710 LET G1=6
720 GOTO 740
730 LET G1=12
740 PRINT "ENTER PRIME INT.RATE"
750 INPUT H
751 PRINT H
760 IF H<.12 THEN GOTO 800
770 IF H<.15 THEN GOTO 820
780 LET H1=12
790 GOTO 840
800 LET H1=3
810 GOTO 840
820 LET H1=6
830 REM TOTAL UP POINTS
840 LET I=A1+B1+C1+D1+E1+F1+G1+H1
850 LET Z$="INTEREST RATE"
860 PRINT
870 REM TESTS FOR POINT TOTAL
880 IF I<=33 THEN GOTO 930
890 IF I<60 THEN GOTO 950
900 IF I<=99 THEN GOTO 970
910 GOTO 990
920 REM PRINTS THE APPLICANTS RATE
930 PRINT Z$,"14 PCT."
940 GOTO 1000
950 PRINT Z$,"17 PCT."
960 GOTO 1000
970 PRINT Z$,"19 PCT."
980 GOTO 1000
990 PRINT Z$,"22 PCT."
\n1000 STOP
\n1010 SAVE "1011%3"
\n1020 LIST
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.
