--- title: "Payroll Message" id: 57237 type: "computer_media" slug: "payroll-message" url: "http://localhost/computer_media/payroll-message/" markdown_url: "http://localhost/computer_media/payroll-message.md" published_at: "2024-10-04T07:00:17+00:00" modified_at: "2026-03-30T21:19:08+00:00" author: "David Anderson" featured_image: url: "http://localhost/wp-content/uploads/2024/10/127_PayM.png" excerpt: "A straightforward payroll calculator prompts for hours worked and hourly rate, then displays a formatted pay message — simple BASIC arithmetic with a tidy output twist." category: - name: "Archived Media" slug: "archived-media" taxonomy: "category" url: "http://localhost/category/archived-media/" post_tag: - name: "Downloadable" slug: "downloadable" taxonomy: "post_tag" url: "http://localhost/tag/downloadable/" - name: "TS 1000" slug: "ts1000" taxonomy: "post_tag" url: "http://localhost/tag/ts1000/" model: - name: "Timex/Sinclair 1000" slug: "ts-1000" taxonomy: "model" url: "http://localhost/model/ts-1000/" genre: - name: "Business" slug: "business" taxonomy: "genre" url: "http://localhost/type/business/" - name: "Finance" slug: "finance" taxonomy: "genre" url: "http://localhost/type/finance/" media_contents: - id: 56734 title: "Timex Sinclair Public Domain Library Tape 1003" type: "computer_media" url: "http://localhost/computer_media/timex-sinclair-public-domain-library-tape-1003/" media_type: "Program" mediadate: "198x" images: - url: "http://localhost/wp-content/uploads/2024/10/127_PayM.png" media_type_tags: "Business, Finance" --- 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. | Line | Variable(s) Used | Purpose | | --- | --- | --- | | 11 | `H` | Input: hours worked | | 21 | `R` | Input: hourly rate | | 30 | `P` | Compute gross pay | | 40–50 | `H`, `R`, `P` | Display 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. ## 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 ```