forked from txs72/JavaTutorial
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGradeExam.java
More file actions
executable file
·38 lines (36 loc) · 1.37 KB
/
GradeExam.java
File metadata and controls
executable file
·38 lines (36 loc) · 1.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
/* */ package ch08;
/* */
/* */
/* */ public class GradeExam
/* */ {
/* */ public static void main(String[] args) {
/* 7 */ 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' } };
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* 18 */ char[] keys = { 'D', 'B', 'D', 'C', 'C', 'D', 'A', 'E', 'A', 'D' };
/* */
/* */
/* 21 */ for (int i = 0; i < answers.length; i++) {
/* */
/* 23 */ int correctCount = 0;
/* 24 */ for (int j = 0; j < (answers[i]).length; j++) {
/* 25 */ if (answers[i][j] == keys[j]) {
/* 26 */ correctCount++;
/* */ }
/* */ }
/* 29 */ System.out.println("Student " + i + "'s correct count is " + correctCount);
/* */ }
/* */ }
/* */ }
/* Location: /Volumes/TXS.128G/hope useful/practice/2020.jar!/ch08/GradeExam.class
* Java compiler version: 8 (52.0)
* JD-Core Version: 1.1.3
*/