EGRE 245 Programming Project #4 Grading an Exam solution


Original Work


5/5 - (5 votes)

1 Overview
An exam has 2 sections (named Section A and Section B) each containing 4 questions worth
20 points each. Students must answer 5 questions in total with at least 2 from Section A
and 2 from Section B. If more questions than required are answered, then the first ones are
counted and the later ones are disregarded. Unanswered questions are indicated by a grade
of 0.
Write a C program to read in each student’s id number (a 4 digit value) followed by 8 scores
(with each score being in the range 0–20 inclusive). An id number of 0 indicates the end
of input. You may assume the correct number of input values are entered; however, if any
score is out-of-range you are to replace it in your calculations (and the output table) with a
0. Here is some sample input data:
1234 10 15 0 0 20 8 17 0
3200 10 9 7 20 -2 24 0 10
9122 5 6 10 0 19 5 3 14
6022 0 0 0 20 0 15 0 6
1077 20 18 0 0 20 19 16 0
Input to your program must come from standard input via redirection on the command
line (as discussed in class; see the sample run below). You will echo print each student’s
id and scores along with printing out their result and all appropriate comments. Output,
including all labels and spacings, must appear exactly as it appears in the sample run below.
Depending on the data entered your program should also print out 0 or more of the following
comments in the order and manner that is shown in the sample run:
Score incorrect.
More than 5.
Less than 5.
Too many from A.
Too many from B.
You also should report the total number of students who took the exam along with the
average result.
2 Sample Run
3 Deliverables
Name your source code file proj4XXXX.c where XXXX is the last 4 digits of your student
id number. For example, if your student id number is V12345678, your file will be named
‘proj45678.c’. Submit your project in the usual way via the web using the link o↵ of the
class web page.
Due date: Thursday, February 26th