This program calculates the time required for a trip given a fixed distance and rate (speed). It divides a hardcoded distance of 250 miles by a rate of 65 (miles per hour) and prints the result in hours. The values for distance and rate are set as constants in lines 20 and 30, and the REM comments instruct the user to modify those lines directly when different values are needed. Lines 65–80 appear to be utility lines for saving and listing the program, placed after the STOP statement so they do not execute during normal program flow.
Program Analysis
Program Structure
The program is straightforward and linear. Execution begins at line 5 (a REM) and flows through to line 60 where a STOP halts execution. Lines 65–80 are utility lines that are never reached during a normal run.
- Lines 5–13: REM documentation and output header
- Lines 20–30: Constant assignment —
D=250(distance),R=65(rate/speed) - Line 40: Core calculation —
T=D/R - Line 50: Output of result
- Line 60:
STOP— normal program termination - Lines 65–80: Post-STOP utility lines (
CLEAR,SAVE,LIST)
Variables
| Variable | Purpose | Value |
|---|---|---|
D | Distance | 250 |
R | Rate (speed) | 65 |
T | Time (result) | D/R ≈ 3.84615… |
Key BASIC Idioms and Notable Techniques
The program uses a purely hardcoded approach to input: the REM at line 11 explicitly tells the user to modify D and R in lines 20 and 30 directly, rather than using INPUT statements. This was a common technique in early hobbyist programs to keep code minimal and avoid input-handling overhead.
The result T is printed with surrounding spaces in the PRINT statement on line 50 (" ";T;" HOURS.") to visually separate the numeric value from the surrounding label text.
Post-STOP Utility Lines
Lines 65–80 are placed deliberately after STOP and are never executed during a normal run. They represent a developer workflow pattern: CLEAR at line 65 would reset variables, SAVE at line 70 saves the program, and LIST at line 80 would display the listing — useful commands to have accessible by editing the STOP line or jumping to them manually via GO TO.
Bugs and Anomalies
- There is no
INPUTprompt, so each new calculation requires the user to manually edit lines 20 and 30 — functional but not user-friendly. - No units are enforced or labelled for distance or rate; the output says “HOURS” but the correctness depends entirely on the user supplying consistent units.
- Line 65 (
CLEAR) followsSTOPimmediately in line numbering but would reset all variables if reached, which could be confusing if a user attempts to resume execution after aSTOP.
Content
Source Code
5 REM TIME/DISTANCE CALCULATION
10 REM KNOW DISTANCE/RATE
11 REM DISTANCE/RATE MOD AS REQURED
12 PRINT "TIME REQUIRED FOR TRIP WHEN DISTANCE/TIME KNOWN"
13 PRINT
20 LET D=250
30 LET R=65
40 LET T=D/R
50 PRINT "THE TIME REQUIRED IS ";T;" HOURS."
60 STOP
65 CLEAR
70 SAVE "1002%1"
80 LIST
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.
