Design help for beginner
I'm very new at programming and am trying to teach myself how to do some basic things. However, I do not know how to attack this problem very well beyond some basic outlines. Could someone create a skeleton of this problem for me? I need to create a few functions to use within the program, as well as set up arrays to hold the "grades" for the students. I realize this is way too much to ask, but I'd appreciate any aid I may receive. If nothing else, please help me understand how to use an array in this situation.
Write a program that will read in a file of data which contains the results of students taking a math exam. Your program will report the score and grade of each student as well as do some item analysis on the questions.
The answers are in the form of floating point numbers which represent the answer the student wrote down. The format of the data file is:
* The very first line of the file will contain an integer which is the number of questions on each test. This number will be positive and no larger than 100. There will also be a floating point number on the same line, which represents a range. This is described below. The numbers are delimited by whitespace.
* The second line of the file should contain the word KEY. Then the next (third) line will have the correct answers for the test. If the key is not found, your program should announce the fact and stop immediately.
* The next lines will be in pairs. The name of the student (may have spaces in it) will be on one line and the student's answers will be on the next line. There may be ANY number of students in the file.
The program should ask the user for the name of the data file with the data to be processed in it. As usual, if the file does not exist, that fact is announced and the program stops.
The range represents the fact that the teacher is allowing for small errors in calculation in the students' work. If the key says the correct answer is 8.1 and the range is 0.1, the program should accept numbers from 8.0 to 8.2. The range will be a single number, it applies to all the answers on the test.
The term item analysis means to keep a count of how many times each question is missed. This can range from 0 (everyone got it right) to the number of students (everyone missed it). The tests are scored with each question worth one point. The score of each student is how many questions they got right. The average is calculated as the sum of the scores divided by the number of students. Be careful not to divide by zero. If zero students are processed, what's a reasonable value for the average?
Your program should also report the letter grade for individual students. The grading scale is the usual one,
* 90-100% = A
* 80 up to 90% = B
* 70 up to 80% = C
* 60 up to 70% = D
* below 60% = E
Sample interaction with the user:
Enter file name: testdata
testdata processed.
The input file for this is called testdata:
10 0.1
KEY
1.0 2.0 3.5 4.4 5.5 6.6 7.7 8.0 9.0 123.4
John Smith
1.0 2.1 3.4 4.4 4.5 7.7 7.7 8.1 9.0 123.4
Ralph Johnson
1.0 2.0 3.5 4.4 5.5 6.6 7.7 8.0 9.0 123.4
close student
1.1 2.1 3.6 4.3 5.4 6.5 7.6 7.9 8.9 123.3
another student
0.9 4.1 3.2 5.92 7.34 6.7 8.1 8.0 9.0 123.5
yet another student
0.9 4.1 3.2 5.92 7.34 6.7 8.1 8.0 9.0 123.5
Missed them all
0.5 4.1 3.2 5.92 7.34 6.9 8.1 8.5 9.2 143.5
The program creates an output file of testdata.out:
For 6 students
Number of questions 10
The range allowed for answers was 0.1
Student Average = 63 %
The largest score was 10
The smallest score was 0
Item Analysis
Question # # Missed
1 1 | *
2 3 | *
3 3 | *
4 3 | *
5 4 | *
6 2 | *
7 3 | *
8 1 | *
9 1 | *
10 1 | *
The program also produces an output file called "testdata.grades" that contains student names, scores and letter grades. Its format is kept very plain in case it will be used as input to another program.
John Smith
8 B
Ralph Johnson
10 A
close student
10 A
another student
5 E
yet another student
5 E
Missed them all
0 E
Functions you must write:
* a void function called drawgraph that produces the graph part of the output, 2 parameters
* a char function called lettergrade that returns the letter grade that corresponds to a given score on the test, 2 parameters
* a void function called getanswers that returns the name of the student and the answers given by that student, 4 parameters
The number of parameters for each function is not cast in stone, but it should give you an idea of how many to have.
|