--- title: "Quote" id: 57587 type: "computer_media" slug: "quote" url: "http://localhost/computer_media/quote/" markdown_url: "http://localhost/computer_media/quote.md" published_at: "2024-10-05T22:37:20+00:00" modified_at: "2026-04-03T07:58:18+00:00" author: "David Anderson" featured_image: url: "http://localhost/wp-content/uploads/2024/10/quote.png" excerpt: "A scrolling job-cost estimator that itemises materials, shop and on-site labour, overhead, and profit, then prints a formatted per-unit and extended quote." 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/" media_contents: - id: 56722 title: "Synchro-Sette December 1982" type: "computer_media" url: "http://localhost/computer_media/synchro-sette-december-1983/" media_type: "Program" mediadate: "December 1982" images: - url: "http://localhost/wp-content/uploads/2024/10/quote.png" - url: "http://localhost/wp-content/uploads/2024/10/quote2.png" media_type_tags: "Business" --- # Quote This program is a job cost estimator that calculates and prints a formatted quote for installation work, covering materials, shop labour, on-site labour, overhead, and profit. The user can choose to enter costs either as a single total or itemised line by line, with the itemisation routine (subroutine at line 1200) reused for materials, shop labour, and on-site labour. All monetary values are rounded to two decimal places using the classic `INT(100*X+.05)/100` idiom before display. The quote summary is printed via a dedicated subroutine at line 3000, showing both per-unit and extended (total) figures in a tabulated layout using `TAB` stops. *** ## Program Analysis ### Program Structure The program is organised into a main routine and three subroutines, with the main flow running from lines 10–690 and looping back to line 100 for repeated estimates. The global counter `D` (initialised at line 20, incremented at line 205) tracks the estimate number across sessions. | Line Range | Purpose | | --- | --- | | 10–20 | Initialisation: CLS, set estimate counter `D=0` | | 100–690 | Main loop: title display, user prompts, cost collection, quote display, loop back | | 1000–1190 | Subroutine: material cost entry (itemised or lump sum) | | 1200–1670 | Subroutine: generic itemised cost entry, accumulating into `C` | | 2000–2550 | Subroutine: shop and on-site labour entry (itemised or lump sum) | | 3000–3270 | Subroutine: formatted quote printout | | 9998–9999 | SAVE with auto-run flag, then RUN | ### Itemised Entry Subroutine (Lines 1200–1670) The subroutine at line 1200 is a reusable itemised cost collector. It loops, prompting for item name, unit cost, and quantity, computing the extended cost (`E = A * G`), and accumulating the running total in `C`. Entry of a blank item name (`B$=""` at line 1255) terminates the loop. The result is returned in `C`, which the calling code then assigns to the appropriate variable (`M`, `L`, or `H`). This reuse of a single subroutine for three different cost categories is the most structurally notable aspect of the program. There is a variable name collision hazard: `C` is used both as the overhead percentage (entered at line 410 and used in the formula at line 430) and as the accumulator inside the itemised entry subroutine (line 1200). After an itemised entry call, `C` is immediately copied to the target variable (lines 1155, 2120), but the overhead percentage previously stored in `C` is overwritten if itemisation is called after line 410 — however, in the actual execution order, overhead is collected after all labour and material subroutines have returned, so in practice this does not corrupt the overhead value during normal flow. The overhead percentage value in `C` is still correctly used at line 3200 for display. ### Cost Calculation (Lines 550–640) The quote calculations at lines 550–640 derive all figures from the per-unit costs and the installation count `Q`: - `B = Q * M` — total materials - `K = Q * L` — total shop labour - `J = H * Q` — total on-site labour - `V = O * (L + H)` — overhead per unit (percentage of direct labour) - `W = V * Q` — total overhead - `R = P * (B + K + J + W)` — total profit - `X = R / Q` — profit per unit - `S = B + K + J + R + W` — total job quote - `T = S / Q` — quote per unit ### Rounding Technique Monetary values are rounded to two decimal places just before display using the standard fixed-point idiom `INT(100*X+.05)/100`. This appears both in the itemised entry loop (line 1455) and throughout the summary subroutine (lines 3102–3256). The `+.05` bias provides conventional rounding (round half up) rather than truncation. ### SCROLL-Based Display The program uses `SCROLL` extensively to control screen layout rather than `CLS`, producing a continuous paper-tape style output. Multiple consecutive `SCROLL` calls are used to create blank-line spacing between sections. `CLS` is reserved for major section transitions (title screen, start of quote entry, itemised cost screens). ### Input Validation Yes/No prompts are validated by checking the first character of the input string (e.g. `B$(1)="Y"`). If neither “Y” nor “N” is matched, execution falls through to a `GOTO` back to the `INPUT` line, forming a simple validation loop. This pattern appears at lines 1050–1070, 2040–2060, 2290–2310. ### Notable Anomalies - Line 1155 assigns `M=C` after the itemised material subroutine, but note that the subroutine itself uses `C` as its accumulator, overwriting the overhead percentage if overhead were collected before this point. In the actual execution order this is safe, but the reuse of `C` for two distinct purposes is fragile. - The spelling “INSTALATIONS” (one ‘l’) at line 3080 is a typo in the output text. - Line 2130 uses `GOTO 2240` to skip the lump-sum shop labour input block, jumping directly to the on-site labour section — a straightforward forward jump with no structural issue. - The `INPUT Y$` at line 220 and line 530 simply waits for Enter; the content of `Y$` is discarded, making these effectively “press Enter to continue” pauses. ## Source Code ``` 10 CLS 20 LET D=0 100 CLS 110 PRINT AT 12,0;" %*%*%*% %J%O%B% %Q%U%O%T%E% %E%S%T%I%M%A%T%E%R% %*%*%*" 200 SCROLL 205 LET D=D+1 210 PRINT " PRESS ENTER TO START :::" 220 INPUT Y$ 230 CLS 240 SCROLL 250 PRINT "JOB NAME? "; 260 INPUT N$ 270 PRINT N$ 280 SCROLL 290 SCROLL 300 PRINT "NUMBER OF INSTALLATIONS?" 310 SCROLL 320 INPUT Q 330 PRINT ,Q 340 SCROLL 350 SCROLL 360 GOSUB 1000 370 GOSUB 2000 380 SCROLL 390 PRINT "OVERHEAD (PER. OF DIRECT LABOR)?" 400 SCROLL 410 INPUT C 420 SCROLL 425 PRINT ,C 426 SCROLL 430 LET O=C/100 440 SCROLL 450 PRINT "PROFIT (PER OF JOB COST)?" 460 SCROLL 470 INPUT Z 480 PRINT ,Z 490 SCROLL 500 SCROLL 510 LET P=Z/100 520 PRINT "PRESS ENTER TO SEE QUOTE :::" 530 INPUT Y$ 540 CLS 550 LET B=Q*M 560 LET K=Q*L 570 LET J=H*Q 590 LET V=O*(L+H) 600 LET W=V*Q 610 LET R=P*(B+K+J+W) 620 LET X=R/Q 630 LET S=B+K+J+R+W 640 LET T=S/Q 650 GOSUB 3000 660 SCROLL 665 SCROLL 670 PRINT "PRESS ENTER FOR ANOTHER QUOTE ::" 680 INPUT Y$ 690 GOTO 100 1000 PRINT "ARE MATERIAL COSTS TO BE" 1010 SCROLL 1020 PRINT "ITEMIZED (Y/N)?" 1030 SCROLL 1040 INPUT B$ 1050 IF B$(1)="Y" THEN GOTO 1100 1060 IF B$(1)="N" THEN GOTO 1160 1070 GOTO 1040 1100 SCROLL 1110 SCROLL 1120 PRINT "MATERIAL COSTS :::" 1130 SCROLL 1140 SCROLL 1150 GOSUB 1200 1155 LET M=C 1156 RETURN 1160 SCROLL 1170 SCROLL 1180 PRINT "TOTAL MATERIAL COST? "; 1184 INPUT M 1186 PRINT M 1188 SCROLL 1190 RETURN 1200 LET C=0 1205 SCROLL 1210 PRINT "ESTIMATE NO.";D 1220 SCROLL 1230 SCROLL 1240 PRINT "ITEM?", 1250 INPUT B$ 1255 IF B$="" THEN GOTO 1600 1260 PRINT B$ 1270 SCROLL 1280 SCROLL 1290 PRINT "COST?", 1300 INPUT A 1310 PRINT A 1320 SCROLL 1340 SCROLL 1350 PRINT "QUANTITY?", 1360 INPUT G 1370 PRINT G 1380 LET E=A*G 1390 SCROLL 1400 SCROLL 1410 SCROLL 1430 PRINT "ITEM COST QUANT EXTEND" 1440 SCROLL 1450 SCROLL 1455 LET E=INT (100*E+.05)/100 1460 PRINT B$;TAB 8;A;TAB 16;G;TAB 24;E 1470 SCROLL 1480 SCROLL 1490 LET C=C+E 1500 GOTO 1220 1600 SCROLL 1605 SCROLL 1610 PRINT "TOTAL",C 1620 SCROLL 1630 SCROLL 1640 PRINT "PRESS ENTER TO CONTINUE :::" 1650 INPUT B$ 1660 CLS 1670 RETURN 2000 SCROLL 2010 SCROLL 2020 PRINT "DO YOU WANT SHOP LABOR ITEMIZED?" 2030 INPUT Y$ 2040 IF Y$(1)="N" THEN GOTO 2140 2050 IF Y$(1)="Y" THEN GOTO 2070 2060 GOTO 2030 2070 SCROLL 2080 SCROLL 2090 PRINT "SHOP LABOR PER HOUR" 2100 SCROLL 2110 SCROLL 2115 GOSUB 1200 2120 LET L=C 2130 GOTO 2240 2140 SCROLL 2150 SCROLL 2160 PRINT "COST FOR TOTAL SHOP LABOR?" 2170 SCROLL 2180 SCROLL 2190 INPUT L 2200 PRINT ,L 2210 SCROLL 2240 SCROLL 2260 PRINT "ON SITE LABOR TO BE ITEMIZED?" 2270 SCROLL 2280 INPUT B$ 2290 IF B$(1)="Y" THEN GOTO 2320 2300 IF B$(1)="N" THEN GOTO 2500 2310 GOTO 2280 2320 CLS 2330 PRINT ,,"ON SITE LABOR PER HOUR :::" 2340 GOSUB 1200 2350 LET H=C 2360 RETURN 2500 SCROLL 2510 SCROLL 2520 PRINT "ON SITE LABOR TOTAL COST?" 2530 INPUT H 2540 SCROLL 2550 RETURN 3000 SCROLL 3010 SCROLL 3020 PRINT "NAME ";N$;TAB 16;"ESTIMATE ";D 3030 SCROLL 3040 SCROLL 3050 PRINT "EST PAR NO. UNITS EXTENDED" 3060 SCROLL 3070 SCROLL 3080 PRINT "NUMBER OF INSTALATIONS ";Q 3090 SCROLL 3100 SCROLL 3102 LET M=INT (100*M+.05)/100 3104 LET B=INT (100*B+.05)/100 3110 PRINT "MATERIAL COST ";M;TAB 25;B 3120 SCROLL 3130 SCROLL 3132 LET L=INT (100*L+.05)/100 3134 LET K=INT (100*K+.05)/100 3140 PRINT "SHOP LAB COST ";L;TAB 25;K 3150 SCROLL 3160 SCROLL 3162 LET H=INT (100*H+.05)/100 3164 LET J=INT (100*J+.05)/100 3170 PRINT "SITE LAB COST ";H;TAB 25;J 3180 SCROLL 3190 SCROLL 3195 LET W=INT (100*W+.05)/100 3196 LET V=INT (100*V+.05)/100 3200 PRINT "OVRHD";" (";C;")";TAB 14;V;TAB 25;W 3210 SCROLL 3220 SCROLL 3225 LET R=INT (100*R+.05)/100 3226 LET X=INT (100*X+.05)/100 3230 PRINT "PROFIT";" (";Z;")";TAB 14;X;TAB 25;R 3240 SCROLL 3250 SCROLL 3255 LET S=INT (100*S+.05)/100 3256 LET T=INT (100*T+.05)/100 3260 PRINT "JOB QUOTE";TAB 14;T;TAB 25;S 3270 RETURN 9998 SAVE "QUOT%E" 9999 RUN ```