Date: Mon, 11 Nov 1996 17:57:29 GMT
Server: NCSA/1.5
Content-type: text/html
Last-modified: Thu, 18 Apr 1996 22:56:19 GMT
Content-length: 10149
- Due Date:
- Wednesday 5/1/96, 8:50 am
- Grade:
- 25% of your final grade.
- Text Covered:
- Chp. 1, 2, 3, 4 and 5
- Problem Description:
- Suppose you are a TA for CS 123 - Introductory Problem Solving, a one-credit Pass/Fail course that is graded off four programming assignments. To save time in computing the final grades for your class you decide write a computer program to help you. The data for each student in the class is stored in two files. The first file contains the name and ID number of each student. The second file contains the ID number and assignment scores for each student. Your program will read in these two files and write a table to a third results file showing each student's name, ID number, average and final grade.
This is a typical file processing problem. It is non-interactive because the user does not type in anything at the keyboard - all the necessary input comes from files that are already on disk. The user also does not see any results on the screen because the results file is also written directly to disk. File processing programs can be difficult to debug because they are non-interactive and its hard to determine exactly where the error(s) occurr.
This assignment is non-trivial so I would strongly suggest starting it as soon as possible.
- Student Data File Format:
- The name and ID number of each student is stored on a single line in the student data file in the following format:
Column Data Variable Type
------ ---- -------------
1-20 Name CHARACTER *20
21-30 ID Number CHARACTER *10
For example,
Clark Kent 1679689152
Gareth Bestor 3912232504
I have created an example student data file which you should use to test your program, called "r:\public\bestor\cs110\students.txt". You may want to print off this file to check that your program is producing the correct results.
- Assignment Scores File Format:
- The programming assignment scores for each student are stored on a single line in the scores data file. The first item on each line is the student's ID number followed by four REAL numbers, one for each assignment, in the following format:
Column Data Variable Type
------ ---- -------------
1-10 ID number CHARACTER *10
11-15 Assignment #1 REAL
16-20 Assignment #2 REAL
21-25 Assignment #3 REAL
26-30 Assignment #4 REAL
For example,
391223250479.2592.3383.7595.00
167968915296.5925.8255.9192.90
I have created an example assignment scores file which you should use, called "r:\public\bestor\cs110\scores.txt". You may want to print off this file also.
- Results File:
- The purpose of your program is to write a table to the results file summarizing all the assignment scores and final grades for each student (Note: this table is not printed on the screen). The table must show the name, ID number, assignment scores, average and final grade for every student. All averages should be displayed rounded to two decimal places.
You may display this information in any format you like but the resulting table must be neat with all the columns lining up and everything appropriately labelled. For example,
Name ID Number Prog1 Prog2 Prog3 Prog4 Avg Grade
--------------------+----------+-----+-----+-----+-----+-----+-----
Clark Kent 1679689152 96.59 25.82 55.91 92.90 67.81 Pass
Gareth Bestor 3912232504 79.25 92.33 83.75 95.00 87.58 Pass
- Program Design:
- Your program should first OPEN the results file and write any preliminary table headings to it. Then OPEN the student data file and read in the first student. You must then open up and read through the assignment scores file one line at a time until you find the scores for that student. After finding their assignment scores compute their average and final Pass/Fail grade. The final grade is given by:
Fail: Avg < 65.0
Pass: Avg >= 65.0
Finally write everything about this student to the results file in the appropriate columns. After you have finished processing the first student, read in the next student from the student data file and process him or her the same way. Continue processing all the students in this way until you reach the end of the student data file.
Notes:
- To search through the assignment scores file to find the scores for a particular student you must first OPEN the file and read in the first line. If the ID number of this line matches the ID number of the student you are looking for then you have found it. If the ID number does not match then ignore the line and read in the next one until you find one that matches. After you find a match CLOSE the scores file so that you can re-OPEN it again later when you search through it for the next student.
- All the students listed in the student data file will have one corresponding line in the assignment scores file (i.e. you will always find a match eventually).
- You do not know ahead of time how many students are in the class (i.e. you do not know the length of either file).
- Debugging:
- To help debug your program you should print messages on the screen whenever anything significant happens. For example, when you read in a student from the student data file print their name and ID number. Also, when you read in each line from the scores file print that student's ID number and whether or not it matches the one you are looking for. This is a very useful debugging technique and will help you track down bugs if your program crashes. For example,
Read in student Clark Kent 1679689152
Read in scores for student 3912232504
Read in scores for student 1679689152
Found student! Computing average and grade
Writing to results file
Read in student Gareth Bestor 3912232504
Read in scores for student 3912232504
Found student! Computing average and grade
Writing to results file
- Demo Program:
- There is a compiled version of my solution available for reference, called "r:\public\bestor\cs110\program3.exe". You may copy my solution to your own directory and run it to see what sort of debugging messages should be displayed and what the results file should look like. I encourage you to use my solution to check the output of your program, but obviously do not use it to generate the output that you hand in (I will run your program myself to confirm this).
- Skeleton Program:
- There is a skeleton file my solution available to get you started, called "r:\public\bestor\cs110\program3.for". You should copy my skeleton to your own directory and use it as the basis for writing your program. The skeleton contains the overall structure of the program and has lots of comments indicating what the different sections of the program do. Add the appropriate statements in the spaces provided and complete the documentation. This skeleton is intended to give you a head-start on the program and to show you the sort of programming style you should be aiming for.
- What to Hand In:
- Hand in this assignment online by copying your FORTRAN source code file (e.g. "program3.for") and the compiled executable file (e.g. "program3.exe") to your handin directory. You also have to hand in a printed copy of your FORTRAN source code file, your results file and the screen output when your program is run with my two example files.
- Gradesheet:
- The following gradesheet will be used to grade this assignment. Please take a close look at it to make sure you do everything that is required. Note that you will be graded on correct output for the two files I have provided, so before handing it in you must run your program with these files and check that your program gives the same results as my solution.
Correct Output [20]
Correctly display student name, ID number, [15]
assignment scores, average and final grade
Correct debugging messages [5]
Implementation [22]
Correctly read from student data file [4]
Correctly read from scores data file [4]
Correctly write to results file [4]
Correct use of IF/THEN/ELSE/END IF statement [2]
Correct use of DO WHILE/END DO loop [2]
Correct use of FORMAT statement [2]
Meaningful variable names [2]
Indenting and neatness [2]
Documentation [8]
Program description [4]
Variable definitions [4]
_________________________________________________________
Total (25%) [50]