We want to build a C++ program to help a professor in grading a True/False class
test. The description of the system is as follows:
• The students’ IDs and their answers are stored in a file.
• The first entry (header line) in the file contains the number of students in the
class, followed by a blank, followed by the number of questions in the test,
followed by the correct answers (provided by the professor) to the test in the
form of a sequence of the letters T and F.
• Every other entry (line) in the file contains student ID, followed by a blank,
followed by the student’s answers to the test.
• Example (Figure 1): the file contains five lines, one header and four lines for 4
students:
• The first line indicates that the number of students is equal to 4 and the
number of questions is 20 followed by the correct answers to the 20
questions.
• The other four lines represent IDs and answers of students. Line 2, for
example, is for student ID ABC54102 and his answer to question 1 is
True (T), he did not answer question 2 (blank) and his answer for
question 3 was False (F).
• Each correct answer is awarded two points and each wrong answer
gets ‐1 point, and no answer gets 0 points.
You are asked to write a program that processes data gathered for a test like the
one described above. The output should be sent to an output file and will contain
for each student, on a separate line, the student ID, the answers, the number of
correct answers, the number of wrong answers, the score and finally the grade.
The grade scale is as follows: A: 90%‐100%, B: 80%‐89.99%, C: 70%‐79.99%, D:
60%‐69.99% and finally F: 0%‐59.99%.
1. Guidelines:
• The code must be provided in one source code file.
• The input file and the output file names are provided at the command line
• Since the input file may contain any random number of students and
questions, all data structures (arrays and other variables) must be
implemented using dynamic memory allocation; no static variables are
accepted for this assignment.
• All the memory allocated during the program, must be properly released.
• The format of the output should be similar to the output in Figure 2
• The input file will be similar to the one presented in Figure 1.
• An assignment that does not compile or one that does not provide any
output is automatically marked out of 50% of the overall mark.
2. Deliverable
• One or two short paragraphs describing the architecture of your solution.
Justify in brief the choice of the different functions you implemented, the
nature of their parameters (value, reference), the major data structure used
(variables, arrays and structures, etc.). (20% of the mark)
• C++ code (80% of the mark)
4 20 TTFTFTTTFTFTFFTTFTTF
ABC54102 T FTFTFTTTFTTFTTF TF
DEF56278 TTFTFTTTFTFTFFTTFTTF
ABC42366 TTFTFTTTFTFTFFTTF
ABC42586 TTTTFTTT TFTFFFTF
Figure 1: Sample input
ID ANSWERS CORRECT WRONG SCORE GRADE
ABC54102 T FTFTFTTTFTTFTTF TF 15 3 27 D
DEF56278 TTFTFTTTFTFTFFTTFTTF 20 0 40 A
ABC42366 TTFTFTTTFTFTFFTTF 17 0 34 B
ABC42586 TTTTFTTT TFTFFFTF 14 2 26 D
Minimum 14 0 26 D
Maximum 20 3 40 A
Average 16.5 1.25 31.75 C
Figure 2: Sample output
Thank you