#P3000. CAIE IGCSE CS Speciman Paper A 2023 Paper 2 Problem 13

CAIE IGCSE CS Speciman Paper A 2023 Paper 2 Problem 13

The one-dimensional (1D) array StudentNameStudentName contains the names of students in a class.
The two-dimensional (2D) array StudentMarkStudentMark contains the mark for each subject, for each student.
The position of each student’s data in the two arrays is the same, for example, the student in position 10 in StudentNameStudentName and StudentMarkStudentMark is the same.
The variable ClassSizeClassSize contains the number of students in the class. The variable SubjectNoSubjectNo contains the number of subjects studied. All students study the same number of subjects.
The arrays and variables have already been set up and the data stored.
Students are awarded a grade based on their average mark.

 

Average mark Grade awarded
Greater than or equal to 70 Distinction
Greater than or equal to 55 and less than 70 Merit
Greater than or equal to 40 and less than 55 Pass
Less than 40 Fail

 

Write a program that meets the following requirements:

  • Calculates the combined total mark for each student for all their subjects
  • Calculates the average mark for each student for all their subjects, rounded to the nearest whole number
  • Outputs for each student:
    – Name
    – Combined total mark
    – Average mark
    – Grade awarded
  • Calculates, stores and outputs the number of distinctions, merits, passes and fails for the whole class.

INPUT FORMAT

The first line contains ClassSizeClassSize (ClassSize<=50)(ClassSize <= 50), the ClassSize, SubjectNoSubjectNo (SubjectNo<=50)(SubjectNo <= 50), the the Number of subjects
The second line contains ClassSizeClassSize students' names
The third line to ClassSize+2ClassSize + 2 line, for each student contains SubjectNoSubjectNo Subjects in each line

OUTPUT FORMAT

For each student output 4 lines

  • First line: Name and Name
  • Second line: Combined total mark and Combined total mark
  • Third line: Average mark and Average mark (to one decimal place)
  • Fourth line: Grade awarded and Grade awarded

And each line for Number of Distinctions, Merits, Passes, and Fails

  • First line: Number of Distinctions and Distinctions Number
  • Second line: Number of Merits and Merits Number
  • Third line: Number of Passes and Passes Number
  • Fourth line: Number of Fails and Fails Number

You should declare all variables you used

SAMPLE

INPUT

3 2
Amy Tom Rose
98 86
67 77
32 47

OUTPUT

Name Amy
Combined total mark 184
Average mark 92.0
Grade awarded Distinction
Name Tom
Combined total mark 144
Average mark 72.0
Grade awarded Distinction
Name Rose
Combined total mark 79
Average mark 39.5
Grade awarded Fail
Number of Distinctions 2
Number of Merits 0
Number of Passes 0
Number of Fails 1