-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathQuiz.java
More file actions
27 lines (22 loc) · 789 Bytes
/
Quiz.java
File metadata and controls
27 lines (22 loc) · 789 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
25
26
27
package PackFATPrep;
import java.util.Scanner;
public class Quiz {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
char[][] quiz = new char[11][9];
char[] anskey = { 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A' };
int[] correct = new int[11];
for (int i = 0; i < 11; i++) {
for (int j = 0; j < 9; j++) {
quiz[i][j] = scanner.next().charAt(0);
if (quiz[i][j] == anskey[j]) {
correct[i]++;
}
}
}
for (int i = 0; i < correct.length; i++) {
System.out.println("Student " + i + "has " + correct[i] + "answers correct!");
}
scanner.close();
}
}