-1
I’m a beginner in Java and decided to create this exercise to test my knowledge, but I’m breaking my head to show the values of this Array. I want him to show the name of the student at the end of the execution with his grades, I tried to make a fail-safe. If anyone can help me, I would be grateful! I want the following result at the end of the execution:
Name: Aluno1 Note1: Nota2:
Name: Aluno2 Note1: Nota2:
Scanner entrada = new Scanner(System.in);
double numero[] = new double[2];
String nome[] = new String[2];
for (int contador = 0; contador < nome.length; contador++) {
System.out.println("Nome " + (contador + 1));
nome[contador] = entrada.next();
for (int cont = 0; cont < numero.length; cont++) {
System.out.println("Informe a " + (cont + 1) + "° nota: ");
numero[cont] = entrada.nextDouble();
}
}
for (int cont = 0; cont < nome.length; cont++) {
System.out.println("Nome: " + (cont + 1) + " " + nome[cont]);
for (int conta = 0; conta < numero.length; conta++) {
System.out.println("nota " + (conta + 1) + " " + numero[conta]);
}
}
}
}