--- title: "Student Grade Average" id: 57158 type: "computer_media" slug: "student-grade-average" url: "http://localhost/computer_media/student-grade-average/" markdown_url: "http://localhost/computer_media/student-grade-average.md" published_at: "2024-10-04T01:02:04+00:00" modified_at: "2026-04-03T07:58:42+00:00" author: "David Anderson" featured_image: url: "http://localhost/wp-content/uploads/2024/10/107_Grd.png" excerpt: "A straightforward classroom tool that collects five test scores, computes the average, and prints a formatted summary report — then loops automatically for the next student." 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: "Teaching" slug: "teaching" taxonomy: "genre" url: "http://localhost/type/teaching/" media_contents: - id: 56733 title: "Timex Sinclair Public Domain Library Tape 1002" type: "computer_media" url: "http://localhost/computer_media/timex-sinclair-public-domain-library-tape-1002/" media_type: "Program" mediadate: "198x" images: - url: "http://localhost/wp-content/uploads/2024/10/107_Grd.png" media_type_tags: "Teaching" --- # Student Grade Average This program calculates and prints a student grade average from five individual scores. It prompts the user to enter a date, a student name, and five numeric scores via INPUT statements, then echoes each entry to the printer with LPRINT. After all scores are collected, it computes the total with a single LET statement and divides by five to produce an average, which is printed in a summary report. The program loops continuously via GOTO 20, allowing multiple students to be processed in sequence, and uses CLEAR before each new iteration to free string storage. *** ## Program Analysis ### Program Structure The program is organised into a clear linear sequence with a continuous loop. Line numbering uses large, irregular gaps (e.g. jumping from 32 to 2500, then incrementing by 1 for related sub-steps), which is a common informal style rather than a deliberate design. The overall flow is: 1. Lines 10–32: Print header and collect/print the date. 2. Lines 2500–4002: Collect student name and five scores, echoing each to the printer via `LPRINT`. 3. Lines 5000–6000: Spacing and summary header. 4. Lines 7000–7001: Compute total (`E`) and average (`A`). 5. Lines 8000–8020: Print average, clear memory, and loop back to line 20. 6. Lines 8900–9000: Utility lines for saving and listing. ### Input and Output Strategy Every data item entered via `INPUT` is immediately echoed to the printer with a paired `LPRINT` statement. This mirrors the entered data onto paper as a record, since the screen display alone would be lost on the next iteration. The date is only collected once at line 31 and printed once at line 32, but the loop at line 8020 returns to line 20, meaning the date header is re-printed to the printer for every student — potentially cluttering the printout if many students are processed. ### Calculation The average is computed across exactly five scores using two `LET` statements at lines 7000–7001. The intermediate sum variable `E` is retained but only `A` (the average) is printed. There is no rounding applied; the result will be printed with full floating-point precision as provided by the runtime. ### Variable Summary | Variable | Purpose | | --- | --- | | `D$` | Date string entered by user | | `N$` | Student name | | `E1`–`E5` | Individual scores (numeric) | | `E` | Sum of all five scores | | `A` | Calculated average | ### Notable Techniques and Idioms - `CLEAR` at line 8010 is used before looping. This resets all variables and frees string storage, which is a standard housekeeping practice in looping programs that repeatedly assign string variables like `N$` and `D$`. - The blank `PRINT` statements at lines 2650, 2651, 5000, and 5001 produce empty lines for visual spacing on screen. - Lines 8900 (`SAVE`) and 9000 (`LIST`) are utility lines intended to be run manually by the user and are never reached by the normal program flow. ### Bugs and Anomalies - The loop returns to line 20 rather than line 2500, so the “STUDENT GRADE AVERAGE” header and the date prompt are re-issued on every iteration. The date would need to be re-entered for each student, which is likely unintentional. A loop back to line 2500 would be more practical for batch use. - There is no validation of score inputs; non-numeric entries would cause an error. - The number of scores is hardcoded to exactly five with no facility for fewer scores or an absent result. ## Source Code ``` 10 REM STUDENT GRADE AVERAGE 20 LPRINT "STUDENT GRADE AVERAGE" 30 PRINT "ENTER DATE" 31 INPUT D$ 32 LPRINT D$ 2500 PRINT "ENTER STUDENT NAME" 2600 INPUT N$ 2601 LPRINT N$ 2650 PRINT 2651 PRINT 2700 PRINT "ENTER SCORE 1" 2701 INPUT E1 2702 LPRINT E1 2800 PRINT "ENTER SCORE 2" 2801 INPUT E2 2802 LPRINT E2 2900 PRINT "ENTER SCORE 3" 2901 INPUT E3 2902 LPRINT E3 3000 PRINT "ENTER SCORE 4" 3001 INPUT E4 3002 LPRINT E4 4000 PRINT "ENTER SCORE 5" 4001 INPUT E5 4002 LPRINT E5 5000 PRINT 5001 PRINT 6000 LPRINT "SUMMARY REPORT FOR ";N$ 7000 LET E=E1+E2+E3+E4+E5 7001 LET A=E/5 8000 LPRINT "AVERAGE SCORE=";A 8010 CLEAR 8020 GOTO 20 8900 SAVE "1010%7" 9000 LIST ```