Media Money

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

This program calculates and compares the Cost Per Mille (CPM) — the cost per 1,000 impressions — for two advertising media, such as newspapers or magazines. The user enters a name, ad cost, and circulation figure for each medium; the program divides cost by circulation and multiplies by 1,000 to produce the CPM for each. It then prints both CPM values and identifies which medium offers the lower cost, or reports no difference if they are equal. After displaying results, it waits for a keypress and loops back to accept new inputs.


Program Analysis

Program Structure

The program is straightforward and linear, divided into three functional phases:

  1. First medium input (lines 10–100): Prompts for name (N$), ad cost (A), and circulation (C); computes CPM as M = 1000 * (A / C).
  2. Second medium input (lines 110–200): Repeats the same process for variables P$, Q, R, and S.
  3. Results and loop (lines 210–350): Displays both CPM values, compares them with three IF statements, waits for a keypress, clears the screen, and loops back to line 10.

CPM Calculation

The core formula at lines 100 and 200 is standard advertising mathematics: multiply the ratio of cost to circulation by 1,000 to give the cost per thousand readers or viewers. The parentheses around A/C are redundant but harmless, as division already has higher precedence than multiplication.

Key Variables

VariableMeaning
N$Name of first medium
AAd cost for first medium
CCirculation of first medium
MCPM for first medium
P$Name of second medium
QAd cost for second medium
RCirculation of second medium
SCPM for second medium

Notable Techniques

  • Keypress wait loop: Line 330 uses IF INKEY$="" THEN GOTO 330, a standard busy-wait idiom for pausing execution until any key is pressed.
  • Three-way comparison: Lines 250270 use three separate IF statements testing S>M, M>S, and M=S to cover all cases. This is idiomatic for BASIC dialects lacking ELSE or SELECT CASE.
  • Continuous loop: The program never truly ends during normal use; line 350 sends execution back to line 10 after each comparison, allowing repeated use without restarting.

Bugs and Anomalies

  • Line 140 typo: POKE "AD COST: $ "; should almost certainly be PRINT "AD COST: $ ";. As written, the POKE keyword expects two numeric arguments (an address and a value), so this line would produce a syntax or type error at runtime. This is evidently a transcription error in the listing.
  • Unreachable lines 375–500: Lines 375 (CLEAR), 400 (SAVE "1001%5"), and 500 (RUN) are never reached during normal execution because the loop at line 350 returns to line 10 indefinitely. These lines exist solely for the user to GOTO or execute manually — the SAVE at line 400 stores the program with an auto-run flag encoded in the filename.
  • Division by zero risk: If the user enters 0 for circulation, lines 100 or 200 will cause a division-by-zero error. No input validation is provided.

Content

Appears On

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

Related Products

Related Articles

Related Content

Image Gallery

Media Money

Source Code

   5 REM MEDIA MONEY
   6 REM CHOOSE LOWER COST ADS**
  10 PRINT "FIRST MEDIUM: ";
  20 INPUT N$
  30 PRINT N$
  40 PRINT "AD COST: $ ";
  50 INPUT A
  60 PRINT A
  70 PRINT "CIRCULATION: ";
  80 INPUT C
  90 PRINT C
 100 LET M=1000*(A/C)
 110 PRINT "SECOND MEDIUM: ";
 120 INPUT P$
 130 PRINT P$
 140 POKE "AD COST: $ ";
 150 INPUT Q
 160 PRINT Q
 170 PRINT "CIRCULATION: ";
 180 INPUT R
 190 PRINT R
 200 LET S=1000*(Q/R)
 210 PRINT 
 220 PRINT 
 230 PRINT N$;" CPM: $ ";M
 240 PRINT P$;" CPM: $ ";S
 250 IF S>M THEN PRINT N$;" IS LOWER"
 260 IF M>S THEN PRINT P$;" IS LOWER"
 270 IF M=S THEN PRINT "NO DIFFERENCE"
 300 PRINT 
 310 PRINT 
 320 PRINT "FOR MORE,PRESS ANY KEY"
 330 IF INKEY$="" THEN GOTO 330
 340 CLS 
 350 GOTO 10
 375 CLEAR 
 400 SAVE "1001%5"
 500 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