Bom dia, esse exemplo é para receber alternativas certas como gabarito, e posteriormente receber matricula do aluno, e depois as alternativas escolhidas por ele, no fim deveria ser feito a comparação para se extrair a nota de cada matricula, alguém pode me ajudar, empaquei nisso.
import java.util.Scanner;
public class ExPs2 {
public static void main(String[] args) {
Scanner entrada = new Scanner(System.in);
char gabarito[] = new char[2];
int matricula[] = new int[2];
char questao[] = new char[2];
double nota[] = new double[2];
gabarito(gabarito);
matriQuestao(matricula, questao, gabarito, nota);
nota(matricula, questao, gabarito, nota);
}
private static void gabarito(char gabarito[]) {
Scanner entrada = new Scanner(System.in);
for (int a=0; a<gabarito.length; a++) {
System.out.println("Digite a solução da " + (a+1) + "º Questão: ");
gabarito[a] = entrada.next().charAt(0);
System.out.println("------------------------------");
while(!(gabarito[a] == 'a') && !(gabarito[a] == 'b') && !(gabarito[a] == 'c') && !(gabarito[a] == 'd') && !(gabarito[a] == 'e')) {
System.out.println("Digite a opção Correta (a, b, c, d ou e)");
gabarito[a] = entrada.next().charAt(0);
System.out.println("------------------------------");
}
}
}
private static void matriQuestao(int matricula[], char questao[], char gabarito[], double nota[]) {
Scanner entrada = new Scanner(System.in);
int matricul;
for (int w=0; w<matricula.length; w++) {
System.out.println("Digite a matricula do " + (w+1) + "º Aluno: ");
matricula[w] = entrada.nextInt();
System.out.println("------------------------------");
for (int y=0; y<questao.length; y++) {
System.out.println("Digite a alternativa de número " + (y+1));
questao[y] = entrada.next().charAt(0);
System.out.println("------------------------------");
while(!(questao[y] == 'a') && !(questao[y] == 'b') && !(questao[y] == 'c') && !(questao[y] == 'd') && !(questao[y] == 'e')) {
System.out.println("Digite a opção Correta (a, b, c, d ou e)");
questao[y] = entrada.next().charAt(0);
System.out.println("------------------------------");
for( int u=0; u<matricula.length; u++) {
if(gabarito[u] == questao[u]) {
nota[y]++;
}
}
}
}
System.out.println(nota[w]); **//aqui no fim de cada inserção das alternativas dos alunos deveria vir a nota que ele tirou quando comparado ao gabarito preenchido anteriormente.**
}
}
private static void nota(int matricula[], char questao[], char gabarito[], double nota[]) {
Scanner entrada = new Scanner(System.in);
for (int x=0; x<matricula.length; x++) {
System.out.println("Para a matricula " + matricula[x] + " a nota é: " + nota[x]);
**// E aqui no final deveria mostrar matricula e a nota referente.**
}
}
}
