--- title: "Ad Profit" id: 56991 type: "computer_media" slug: "ad-profit" url: "http://localhost/computer_media/ad-profit/" markdown_url: "http://localhost/computer_media/ad-profit.md" published_at: "2024-10-02T01:22:17+00:00" modified_at: "2026-03-30T21:20:25+00:00" author: "David Anderson" featured_image: url: "http://localhost/wp-content/uploads/2024/10/16_AdPro.png" excerpt: "Enter your retail price, wholesale cost, ad spend, and units sold to instantly calculate campaign profit — or find your break-even point automatically." 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: 56732 title: "Timex Sinclair Public Domain Library Tape 1001" type: "computer_media" url: "http://localhost/computer_media/timex-sinclair-public-domain-library-tape-1001/" media_type: "Program" mediadate: "198x" images: - url: "http://localhost/wp-content/uploads/2024/10/16_AdPro.png" media_type_tags: "Business" --- # Ad Profit This program calculates advertising campaign profit, taking inputs for retail price, wholesale cost, advertising expenditure, and quantity sold. It then computes net profit using the formula E = A×B − A×C − D. A break-even mode is triggered when the user enters 0 for quantity sold, whereupon the program instead solves for the number of units required to achieve a desired profit target using the rearranged formula A = (F+D)/(B−C). The program loops continuously, clearing the screen and restarting the input sequence after each calculation. *** ## Program Analysis ### Program Structure The program is divided into clearly delineated functional blocks: 1. Lines 1–4: Title display and instructions 2. Lines 10–120: Input collection (retail price, wholesale cost, ad cost, quantity sold) 3. Line 130: Branch decision — normal profit vs. break-even mode 4. Lines 200–220: Normal profit calculation and display 5. Lines 300–350: Break-even unit calculation 6. Lines 400–450: Loop control — wait for keypress, clear screen, restart 7. Lines 475–600: Save and auto-run block (never reached in normal execution) ### Key Variables | Variable | Meaning | | --- | --- | | `B` | Retail (list) price per unit | | `C` | Manufacturing or wholesale cost per unit | | `D` | Total advertising cost | | `A` | Quantity sold (or computed break-even quantity) | | `E` | Calculated profit | | `F` | Desired profit (break-even mode input) | ### Profit Calculation In normal mode (line 200), profit is computed as `E = A*B - A*C - D`, which represents total revenue minus total cost-of-goods minus fixed advertising spend. This could be simplified to `E = A*(B-C) - D`, but the expanded form is functionally correct. In break-even mode (line 330), the formula is algebraically rearranged to `A = (F+D)/(B-C)`, solving for the number of units needed. Entering 0 for profit wanted (`F=0`) gives the true break-even unit count. ### Key BASIC Idioms - The keypress-wait loop at line 430 uses `IF INKEY$="" THEN GOTO 430`, a standard polling idiom on this platform. - Each `INPUT` statement is preceded by a `PRINT` prompt and followed by an echoing `PRINT` of the entered value, giving a clean audit trail on screen. - The infinite main loop is driven by `GOTO 10` at line 450 after a `CLS`, recycling the program without restarting it. ### Notable Anomalies - Lines 475 (`CLEAR`), 500 (`SAVE`), and 600 (`RUN`) are unreachable during normal execution; the loop at line 450 never falls through to them. They exist solely as a tape-saving convenience to be run manually. - No input validation is performed: entering identical values for `B` and `C` (i.e., zero margin) in break-even mode causes a division-by-zero error at line 330. - The `PRINT A` echo at line 120 prints the raw numeric value of the quantity entered rather than formatting it with a label, which is inconsistent with the labelled echoes used for `B`, `C`, and `D`. ## Source Code ``` 1 REM AD PROFIT 2 PRINT "%A%D% %C%A%M%P%A%I%G%N% %P%R%O%F%I%T" 3 PRINT "ANSWER QUESTIONS AS REQUESTED. IF YOU WISH TO KNOW HOW MANY UNITS TO SELL TO BREAK EVEN,ANSWER 0 TO NUMBER SOLD AND $ PROFIT WANTED" 4 PRINT 10 PRINT "ITEM LIST/RETAIL PRICE: "; 20 INPUT B 30 PRINT "$";B 40 PRINT "MFG OR WHOLESALE COST: "; 50 INPUT C 60 PRINT "$";C 70 PRINT "AD COST: "; 80 INPUT D 90 PRINT "$";D 100 PRINT "QUANTITY SOLD: "; 110 INPUT A 120 PRINT A 130 IF A=0 THEN GOTO 300 200 LET E=A*B-A*C-D 210 PRINT "$";E;" PROFIT" 220 GOTO 400 300 PRINT "PROFIT WANTED: $ "; 310 INPUT F 320 PRINT F 330 LET A=(F+D)/(B-C) 340 PRINT "YOU MUST SELL ";A 350 PRINT "FOR $ ";F;" PROFIT" 400 PRINT 410 PRINT 420 PRINT "FOR MORE,PRESS ANY KEY" 430 IF INKEY$="" THEN GOTO 430 440 CLS 450 GOTO 10 475 CLEAR 500 SAVE "1001%6" 600 RUN ```