-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGradeExam.java
More file actions
24 lines (23 loc) · 808 Bytes
/
Copy pathGradeExam.java
File metadata and controls
24 lines (23 loc) · 808 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
public class GradeExam {
public static void main(String[] args) {
char[][] answers= {
{'A','B','A','C','C','D','E','E','A','D'},
{'D','B','A','B','C','A','E','E','A','D'},
{'E','D','D','A','C','B','E','E','A','D'},
{'C','B','A','E','D','C','E','E','A','D'},
{'A','B','D','C','C','D','E','E','A','D'},
{'B','B','E','C','C','D','E','E','A','D'},
{'B','B','A','C','C','D','E','E','A','D'},
{'E','B','E','C','C','D','E','E','A','D'}
};
char[] keys= {'D','B','D','C','C','D','A','E','A','D'};
for (int i = 0; i < answers.length; i++) {
int correctCount=0;
for (int j = 0; j < answers[i].length; j++) {
if(answers[i][j]==keys[j])
correctCount++;
}
System.out.println("Student "+i+"'s correct count is "+correctCount);
}
}
}