Description of tasks:
You are required to write a program that will calculate the total marks and the grade the student obtained on a multiple choice test paper. There are 20 questions and each question has an option A,B,C and D. Total of 30 students took the test. The correct answers are stored in an array form as the following:-
char answers[] = {“DAACBBCADCBAABDCDADD”};
The student’s name , matrix number and their answers are stored in a file called answers.dat in the following format:
Phavan 010896 AAACDBBBACDABCDDDADD
Fehreed 170208 DABCBBCADCDABDDDCADD
Each correct question carries 5 marks. The grade obtained is based on the criteria below:-
Marks Grade
100 to 70 - A
69 to 60 - B
59 to 50 - C
49 to 40 - D
39 and below - F
Problem Statement
Write a program that will display the following :-
1) the total marks and grade for each student
2) total number of students for each grade
3) percentage of passes and failures.
Read the data from the file answers.txt and calculate the marks and determine the grade the student obtained. Store the results in another file called results.txt in the following format. The records must be sorted based on the name.
Report on the CSC202 test
Name Matrix Number Total Marks Grade
Ali 1225 90 A
Dave 1227 87 A
Chen 1300 69 B
……
……
Total number of students who scored A : 5
Total number of students who scored B : 6
Total number of students who scored C : .10
Total number of students who scored D :5
Total number of students who scored F :4
Passes : 80%
Failures : 20%
Thanks in advance