#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 contains the names of students in a class.
The two-dimensional (2D) array 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 and is the same.
The variable contains the number of students in the class. The variable
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 , the ClassSize, , the the Number of subjects
The second line contains students' names
The third line to line, for each student contains Subjects in each line
OUTPUT FORMAT
For each student output 4 lines
- First line:
Nameand Name - Second line:
Combined total markand Combined total mark - Third line:
Average markand Average mark (to one decimal place) - Fourth line:
Grade awardedand Grade awarded
And each line for Number of Distinctions, Merits, Passes, and Fails
- First line:
Number of Distinctionsand Distinctions Number - Second line:
Number of Meritsand Merits Number - Third line:
Number of Passesand Passes Number - Fourth line:
Number of Failsand 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