NOTE: this algorithm requires that you read from a file and use an EOF-controlled loop. If you have any questions as to how to proceed, please e-mail me in enough time to help you. There is information in the written lectures about writing EOF loops and toward the end of this problem section.
Your neighbor, an elementary school teacher, has asked you to help her with the 5th Annual Christmas Gala. They’ve planned all sorts of events such as, food, games, and other activities for the children to do in the school’s multipurpose room. The school is a large school, with grades kindergarten through fifth. There are many sections of each grade and hundreds of students attending the school. It is possible that the children may not know many of the children from other classes. Your neighbor wants you to create the logic of a program to print name tags for everyone in the school.
All of the data you’ll need is in a file (you’ll have to use file processing and an EOF loop). Each classes’ data may not be together in the file; this means all student records are in no particular order in the file.
The school class data are in the following format (file description):
File: ClassData
FIELD DESCRIPTION DATA TYPE EXAMPLE
Class Id Character F100
Class Grade Character FIRST
Section Number Numeric 001
Teacher Name Character Palm
Enrollment Numeric 24
Room Character A214
In the file, there is one record for each class section offered at the school. In case you need further explanation of the data, a description of the data is as follows:
Design a program that would read in each record in the file and print as many name tags as a class section needs to provide one for each student in the class, plus one for the teacher (this data is the enrollment plus 1). The name tag would leave a blank for the student’s (or teacher’s) name so the names can be written in by the teacher before handing them out to the students. The tag would look like this (storyboard):
WELCOME TO CHRISTMAS GALA 2012
My name is ________________________
Class Grade: XXXXXXXXXXXX Section: 999
REQUIREMENTS: again, you MUST use an EOF loop with file processing (open and close files, loop using EOF). You will also need a counting loop to process the name tags for each class section (nested in the EOF loop). You must use modules. What you call them is up to you. I want the main algorithm to look like this:
Start
A beginning module to set up everything
A main loop module
A closing module to finish whatever needs to be finished
Stop
This means I want you to have three module calls in the main algorithm (NO OTHER STATEMENTS). All other modules will be called from within one of the three main modules. How you divide up the work and how many modules is up to you, EXCEPT, I want you to design and call a separate module to print the tag. Please see the output storyboard for output information.
Remember, since you’re reading from a file, there is no input interface required. Do not include input prompts (the file can’t read them). Also, you MUST read in every field in each record, even those you don’t intend to use (therefore, you need variables and read statements for each field).
For this assignment, all variables and constants you declare are global to the program. That means you do not pass ANY parameters/arguments into the modules. You must fully define each module, one at a time, AT THE END of the design after you stop your main algorithm. Include only modules calls in the main algorithm. DO NOT define the statements of the modules inside the main algorithm.
NOTE: do not ask the user to make any calculations. The program should make all calculations. Reminder: this design assignment reads from a file, therefore, there’s no input interface. Also, I’ve given you an output storyboard (the tag). You need to either include it in your design as a separate storyboard OR include the labels from it in your output statements. Assume input from a file and output to a printer.
NOTE: please do not include arrays in your design. It is required that you use an EOF loop to process your records. Do NOT forget to open and close your file.
HINT: When using an EOF-controlled loop, you must read all fields in the file, so you need to include them all in the variable list. Think about that reading in the first field in the file (Class Id) is the variable that will control the loop. For example:
Read ClassID
While not EOF
[Loop Body]
Read ClassId
End loop