Advanced Programming | | Notes on Header Record Logic:
Header Record Logic: A counter is still used to control the loop as presented in the last notes. However, the number of loops can vary with each program execution. Inputting a special record before any of the regular input records provides this flexibility. Basically, it specifies how many times the loop will perform and how many additional input records will follow. Header records are separate and not part of the regular input records.

The Basic Header Record: – In the two following examples we will use a variable named TOTNUM as “Total Number” of records to be processed. This also will be placed in a READ statement positioned as the first step within the DOWHILE loop. You will see two READ steps. The first READ is considered the header and is done only once. The second READ step is done every time the loop steps are executed. Having a header record in your DOWHILE loop program gives the user more control of the program.

Adv. Programming - Header Record Logic and Example Problem: #3 Simulation:

Example #3 Simulation (The Basic Header Record Program): – As you study both of the flowcharts below, notice the READ statements are the same, but where you put the variable “TOTNUM” is the difference. The flowchart on the left (incrementing the count) refers to TOTNUM within the test instead of a specific value such as 6 or 10. The flowchart on the right (decrementing the count) indicates that COUNT will initially be set to the value of the TOTNUM instead of a specific value like 6 or 10.

In this problem, you are to regenerate one of the simulations (The Basic Header Record) by recreating and copying the flowchart and coding the programming using the Visual Basic. This is a program that will input a student's name and total number of grades and output a student's grade average. Always apply internal documentation and try to beef up the INPUT and OUTPUT steps of this program. Note, as you can see below just one of the code structure is present. Code program both structure and try to have this program become more user-friendly. Once you get the program running you will be asked to draw the Program Flowchart as well. You will print out the program code with a Flowerbox, the Console Window during run time, and the Flowchart for Example #3.

Flowerbox template:
  [ Flower Box ]

The flowchart design of the
Header Record increment the count
The flowchart design of the
Header Record decrement the count

Teacher's Comments: You will be guided to learn and use the Header Records through the first few programs. Once you finish coding the program using the Console Application, try to make changes by switching the variables TOTNUM with the test and the preparation step.


Directions for turning in Example problem - In the classroom: No Printing just upload the assignment files to Canvas Module 1 Example Problem #3. You will NOT need to print out any documents just submit this example problem in the Canvas drop box. Note you should have three screen shots: example 3 flowchart, code, and console output. Put all screen shots (images) in a Word Document and send me the file. Save the Word document as the example problem: Example Problem 3. Please note, that you will need to re-save this file as a pdf file before uploading. Here is an example video on how to do that: See Video > > >     How to save a Word file to a pdf   right click mouse and select... (Open link in new tab)