Stock Questionnaire

This file is part of and Timex Sinclair Public Domain Library Tape 1001. Download the collection to get this file.
Date: 198x
Type: Program
Platform(s): TS 1000
Tags: Finance

This program implements a 15-question weighted scoring questionnaire to help evaluate whether a particular stock is worth purchasing. The user answers each question by entering a numeric point value directly, covering criteria such as stock price, P/E ratio, trading volume, dividends, broker commission, exchange listed, years in business, and current market conditions. A preliminary question about company deficit status acts as a gating condition — answering “YES” immediately routes to a rejection message. A cumulative score of 27 or more triggers a purchase recommendation, while a lower score outputs a “NOT RECOMMENDED” verdict with “NOT” rendered in inverse video for emphasis. The program uses two shared subroutines (lines 1610 and 1660) to handle point entry and running score display, called in sequence for each of the 15 questions.


Program Analysis

Program Structure

The program is organized into three broad regions: an introduction and preliminary gating question (lines 140–310), the 15-question scoring loop (lines 320–1600), and shared subroutines plus outcome blocks (lines 1610–1800). There is no formal loop construct driving the 15 questions; instead, each question is handled by a block of PRINT statements followed by two GOSUB calls, repeated sequentially from line 360 to line 1510.

Subroutine Design

Two subroutines handle all interactive scoring mechanics:

  • Line 1610 — Prints a prompt, accepts a point value into variable S, adds it to the running total S1, then clears the screen with CLS before returning.
  • Line 1660 — Prints the current running total S1 with surrounding blank lines, then returns.

These two subroutines are called as a pair after every question, making the pattern highly regular and easy to extend. The CLS at line 1641 clears the screen immediately after input, so the user sees only the running score and the next question — a clean, paged interface.

Gating Logic

The preliminary question (lines 260–310) checks whether the company is in a deficit. Entering 1 (YES) immediately jumps to line 1740 — the rejection subroutine. Entering 0 (NO) advances to the questionnaire. Any other value loops back to line 230 to re-display the preliminary question, providing basic input validation.

Scoring and Decision

The accumulator variable S1 is initialised to zero at line 350 and incremented by S after each question at line 1640. After all 15 questions, line 1550 compares S1 against the threshold of 27. Scores below 27 branch to the rejection message at line 1740; scores of 27 or above fall through to the acceptance message. The program relies entirely on the user entering the correct point value for each criterion rather than computing it from raw data inputs — the questionnaire is advisory rather than automated.

Scoring Criteria Summary

#CategoryMax Points
1Stock Price4
2Price Fluctuation (6 months)2
3P/E Ratio4
4Volume Sold3
5Dividends4
6Earnings Trend2
7Recent News2
8Investment Type2
9Recent Splits4
10Broker Commission2
11Exchange Traded On4
12Years in Business4
13Size of Business4
14Earnings & Dividend Ranking4
15Stock Market Conditions2
Maximum Possible47

The recommendation threshold of 27 represents approximately 57% of the maximum possible score of 47, providing a moderate bar for investment approval.

Notable Techniques and Anomalies

  • Line 130 contains REM GOSUB 1710 — this subroutine (lines 1710–1730) implements a simple delay loop counting from 1 to 900, but it is never actually called during normal execution since the GOSUB is inside a REM statement.
  • Line 1770 uses inverse video characters (%N%O%T) to visually emphasise “NOT” in the rejection message, a common display technique for drawing attention to critical output.
  • Line 1790 uses GOTO 1600 which lands on STOP, sharing the same termination point as the acceptance path — a minor but tidy convergence.
  • There is a typographical error in line 190: “ARECOMMENDATION” is missing a space (should be “A RECOMMENDATION”). Similarly, line 200 contains an extra space before “QUESTION” at line 220’s preceding text.
  • The program trusts the user to enter only valid point values for each question; there is no range checking or input validation beyond the preliminary question’s 0/1 guard.
  • Lines 1800–1810 (SAVE and RUN) appear after STOP at line 1600 and are unreachable during normal execution; they are utility lines for saving and restarting the program.

Content

Appears On

Assembled by Tim Ward from many sources. Contains programs 10001 – 10050.

Related Products

Related Articles

Related Content

Image Gallery

Source Code

  50 REM %S%T%O%C%K% %B%U%Y%I%N%G% %G%U%I%D%E
 130 REM GOSUB 1710
 140 PRINT "USE THE FOLLOWING QUESTIONNAIRE TO ";
 150 PRINT "HELP DETERMINE IF A          PARTICULAR STOCK ";
 160 PRINT "WILL BE A GOOD INVESTMENT. THERE ARE ";
 170 PRINT "15        QUESTIONS WITH DIFFERENT "
 180 PRINT "POINT VALUES FOR EACH ANSWER. A TOTAL SCORE ";
 190 PRINT "OF 27 OR BETTER IS ARECOMMENDATION ";
 200 PRINT "TO INVEST IN THE STOCK.  THE PRELIMINARY ";
 210 PRINT "QUESTION MUST BE ANSWERED WITH A ""NO"""
 220 PRINT "TO ALLOW ENTRY INTO THE         QUESTIONNAIRE."
 230 PRINT 
 240 PRINT "PRELIMINARY QUESTION"
 250 PRINT 
 260 PRINT "IS THE COMPANY IN A DEFICIT?"
 270 PRINT "1=YES//0=NO"
 280 INPUT A
 290 IF A=1 THEN GOTO 1740
 300 IF A=0 THEN GOTO 320
 310 GOTO 230
 320 CLS 
 330 PRINT "STOCK BUYING GUIDE"
 340 PRINT 
 350 LET S1=0
 360 PRINT "1-STOCK PRICE"
 370 PRINT 
 380 PRINT "$6 TO $30 = 4 POINTS"
 390 PRINT "GREATER THAN $30 = 2 POINTS"
 400 PRINT "LESS THAN $6 = 0"
 410 GOSUB 1610
 420 GOSUB 1660
 430 PRINT "2-PRICE FLUCTUATION"
 440 PRINT "(LAST 6 MONTHS)"
 450 PRINT 
 460 PRINT "UP=2 POINTS"
 470 PRINT "DOWN=0"
 480 PRINT "NO CHANGE=1 POINT"
 490 GOSUB 1610
 500 GOSUB 1660
 510 PRINT "3-PE RATIO"
 520 PRINT 
 530 PRINT "4/1 TO 8/1=4 POINTS"
 540 PRINT "9/1 TO 13/1=3 POINTS"
 550 PRINT "14/1 TO 17/1=2 POINTS"
 560 PRINT "18/1 TO 24/1=1 POINT"
 570 PRINT "25/1 AND ABOVE= 0"
 580 GOSUB 1610
 590 GOSUB 1660
 600 PRINT "4-VOLUME SOLD,LAST(HUNDREDS)"
 610 PRINT 
 620 PRINT "0 TO 300=0 POINTS"
 630 PRINT "301 TO 600=1"
 640 PRINT "601 TO 1000=2"
 650 PRINT "1001 AND GREATER=3"
 660 GOSUB 1610
 670 GOSUB 1660
 680 PRINT "5-DIVIDENDS"
 690 PRINT 
 700 PRINT "NONE=0 POINTS"
 710 PRINT "1 TO 2 PCT.=1"
 720 PRINT "2.1 TO 3 PCT.=2"
 730 PRINT "3.1 TO 6 PCT.=3"
 740 PRINT "6.1 TO 12 PCT.=4"
 750 PRINT "12.1 PCT AND ABOVE=2"
 760 GOSUB 1610
 770 GOSUB 1660
 780 PRINT "6-EARNINGS"
 790 PRINT 
 800 PRINT "UP=2 POINTS"
 810 PRINT "DOWN= 0"
 820 PRINT "NO CHANGE=1"
 830 GOSUB 1610
 840 GOSUB 1660
 850 PRINT "7-RECENT NEWS ABOUT COMPANY"
 860 PRINT 
 870 PRINT "NO NEWS = 1"
 880 PRINT "GOOD NEWS=2"
 890 PRINT "BAD NEWS=0"
 900 GOSUB 1610
 910 GOSUB 1660
 920 PRINT "8-INVESTMENT TYPE"
 930 PRINT 
 940 PRINT "SHORT TERM=2"
 950 PRINT "LONG TERM=1"
 960 GOSUB 1610
 970 GOSUB 1660
 980 PRINT "9-RECENT SPLITS"
 990 PRINT 
 1000 PRINT "YES=4"
 1010 PRINT "NO=0"
 1020 GOSUB 1610
 1030 GOSUB 1660
 1040 PRINT "10-BROKER COMMISSION"
 1050 PRINT 
 1060 PRINT "3 PCT. OR LESS=2 POINTS"
 1070 PRINT "3.1 TO 4 PCT.=1"
 1080 PRINT "4.1 OR GREATER=0"
 1090 GOSUB 1610
 1100 GOSUB 1660
 1110 PRINT "11-EXCHANGE TRADED ON"
 1120 PRINT 
 1130 PRINT "NEW YORK=4"
 1140 PRINT "AMERICAN=2"
 1150 PRINT "OTHERS = 0"
 1160 GOSUB 1610
 1170 GOSUB 1660
 1180 PRINT "12-NR YRS IN BUSINESS"
 1190 PRINT 
 1200 PRINT "0 TO 6=0"
 1210 PRINT "7 TO 20=1"
 1220 PRINT "21 TO 30=2"
 1230 PRINT "31 TO 40=3"
 1240 PRINT "41 AND ABOVE=4"
 1250 GOSUB 1610
 1260 GOSUB 1660
 1270 PRINT "13-SIZE OF BUSINESS"
 1280 PRINT 
 1290 PRINT "LARGE CORP/CO=4"
 1300 PRINT "MEDIUM SIZE=2"
 1310 PRINT "SMALL=0"
 1320 GOSUB 1610
 1330 GOSUB 1660
 1340 PRINT "14-EARNINGS AND DIVIDEND RANKING"
 1350 PRINT 
 1360 PRINT "A+=4 POINTS"
 1370 PRINT "A = 3"
 1380 PRINT "A-=3"
 1390 PRINT "B+=2"
 1400 PRINT "B=2"
 1410 PRINT "B-=1"
 1420 PRINT "C=0"
 1430 PRINT "D=0"
 1440 GOSUB 1610
 1450 GOSUB 1660
 1460 PRINT "15-STOCK MARKET CONDITIONS"
 1470 PRINT 
 1480 PRINT "UP=2 POINTS"
 1490 PRINT "DOWN/NO CHANGE=0"
 1500 GOSUB 1610
 1510 GOSUB 1660
 1520 PRINT 
 1530 PRINT "FINAL POINT SCORE IS ";S1
 1540 PRINT 
 1550 IF S1<27 THEN GOTO 1740
 1560 PRINT 
 1570 PRINT "THE STOCK IS ACCEPTABLE"
 1580 PRINT 
 1590 PRINT "IT IS RECOMMENDED FOR PURCHASE"
 1600 STOP 
 1610 PRINT 
 1620 PRINT "ENTER POINT VALUE"
 1630 INPUT S
 1640 LET S1=S+S1
 1641 CLS 
 1650 RETURN 
 1660 PRINT 
 1670 PRINT "POINTS SO FAR = ";S1
 1680 PRINT 
 1690 PRINT 
 1700 RETURN 
 1710 FOR A=1 TO 900
 1720 NEXT A
 1730 RETURN 
 1740 PRINT 
 1750 PRINT "THE STOCK IS NOT ACCEPTABLE"
 1760 PRINT 
 1770 PRINT "IT IS %N%O%T RECOMMENDED FOR PURCHASE"
 1790 GOTO 1600
 1800 SAVE "1002%8"
 1810 RUN 

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

People

No people associated with this content.

Scroll to Top