This is what I have:
import java.util.*;
import java.text.*;
public class Lab4 {
public static void main(String[] args) {
Scanner s = new Scanner(System. in );
Scanner keyboard = new Scanner(System. in );
String input;
int students;
int correctAnswers = 0;
char[] answerKey = {
'B', 'D', 'A', 'A', 'C', 'A', 'B', 'A', 'C', 'D', 'B', 'A'
};
char[] userAnswers = new char[answerKey.length];
DecimalFormat df = new DecimalFormat("#0.0");
System.out.print("how many students are in your class?");
input = s.nextLine();
students = Integer.parseInt(input);
String[] name = new String[students];
for (int j = 0; j < students; ++j) {
System.out.print("Enter name of student " + (j + 1) + ": ");
name[j] = s.nextLine();
System.out.print("Enter quiz score answers :");
for (int k = 0; k < answerKey.length - 1; ++k) {
userAnswers[k] = s.next().charAt(0);
}
for (int i = 0; i < userAnswers.length; i++) {
if (userAnswers[i] == answerKey[i]) {
correctAnswers++;
}
}
System.out.println((df.format((correctAnswers / answerKey.length) * 100)) + "%");
}
}
}
But every time I enter in the 12 answers ( correct ones even) it just goes to the next line and doesn't print anything else, idk what is wrong with it, I'm thinking maybe the userAnswers aren't getting assigned correctly?
Anyways any help would be appreciated. thanks