I have an exercise on vetores/array
with simple value, where I must correct a test, comparing it with the feedback and still calculate the percentage of the students that reached the average.
6) Make a program to correct multiple choice tests. Each Proof has eight questions and each question is worth one point. The first set of data to be read is the feedback template. The others are the numbers and the answers they gave the questions. There are ten students enrolled. Calculate and show:
a. The number and grade of each student;
B. The percentage of approval knowing that the minimum grade is 6.
My feedback will be declared at the beginning, that is, I have an array already in the "answers"
The teacher provided an image as she intended the exercise to run
Mycodeiscurrently:
importjava.util.Scanner;publicclassExercicioVetor6{publicstaticvoidmain(String[]args){//TODOAuto-generatedmethodstubScannerscan=newScanner(System.in);intarrayAluno[]=newint[10];String[]gabarito=newString[]{"b", "d", "e", "a", "b", "c", "b", "a"};
String resposta;
int nota = 0;
for (int i = 0; i < 10; i ++) {
System.out.println("--- aluno " + (i+1) + " ---");
for (int j = 0; j < 8; j++) {
System.out.println("digite a resposta da " + (j+1) + " questão");
resposta = scan.next();
if (resposta.equals(gabarito[j]) ) {
nota++;
}
}
System.out.println("A nota do aluno " + (i+1) + " é : " + nota);
nota = 0;
}
}
}
But because of the teacher's exercise, I have to keep the student's answers, then the program will ask for the number of the student desired, compare the answers and finally I must give the percentage of students with an average of 6 up! When I squeeze the code it repeats 10 times for me to enter the students' responses, compares them as feedback and provides the grade!
But I believe that something is missing, I do not know what to do to stay the same as the image!