Payroll Message

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

This program calculates gross pay by multiplying hours worked by an hourly rate. It prompts the user to enter hours and rate via INPUT statements, echoing each value back with PRINT immediately after entry — a common ZX81/TS1000 idiom since INPUT does not display the entered value on its own line in all contexts. The computed pay is displayed in a formatted sentence alongside the input values. The program halts with STOP at line 60, while lines 70 and 80 (SAVE and RUN) are utility lines appended after the main logic.


Program Analysis

Program Structure

The program is organised into three logical phases: input collection (lines 10–22), calculation (line 30), and output (lines 40–50), followed by a STOP at line 60. Lines 70 and 80 are utility lines outside the main execution path.

  1. Lines 10–22: Prompt for and read hours worked (H) and hourly rate (R), echoing each with a PRINT after INPUT.
  2. Line 30: Computes gross pay as P = H * R.
  3. Lines 40–50: Print a formatted summary message including H, R, and P.
  4. Line 60: STOP halts execution cleanly.

Key BASIC Idioms

The pattern of following each INPUT with an immediate PRINT of the same variable (lines 11–12 and 21–22) is a well-known ZX81/TS1000 idiom. On this platform, INPUT does not automatically reprint the accepted value in the normal display area after the input line is processed, so the explicit PRINT serves as confirmation to the user.

Output Formatting

Lines 40 and 50 use semicolon-separated expressions within PRINT to interleave string literals with numeric variables, producing a readable sentence-style output. The dollar sign is embedded as a literal string character since there is no currency-formatting function in this BASIC dialect.

LineVariable(s) UsedPurpose
11HInput: hours worked
21RInput: hourly rate
30PCompute gross pay
40–50H, R, PDisplay formatted result

Notable Observations

  • No input validation is performed; negative or zero values for H or R would produce mathematically valid but nonsensical results.
  • The output on line 50 appends a literal period and space before “THANK YOU-” within the string, indicating the decimal point is cosmetic punctuation rather than a computed value — no rounding or formatting of P is applied.
  • Line 80 (RUN) would restart the program if reached, but it is never reached during normal execution due to the STOP at line 60.

Content

Appears On

Assembled by Tim Ward from many sources. Contains programs 10122 – 10175.

Related Products

Related Articles

Related Content

Image Gallery

Payroll Message

Source Code

   1 REM PAYROLL MESSAGE
  10 PRINT "ENTER HOURS WORKED"
  11 INPUT H
  12 PRINT H
  20 PRINT "ENTER RATE"
  21 INPUT R
  22 PRINT R
  30 LET P=H*R
  40 PRINT "FOR WORKING ";H;" HOURS AT $ ";R;"/HOUR"
  50 PRINT "YOUR PAY IS $ ";P;".  THANK YOU-"
  60 STOP 
  70 SAVE "1012%7"
  80 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