Question: public class Problem5{ // Program to display number of correct and incorrect answers public static void main(String []args){ char[] answerKeyFromChars = { 'D', 'B', 'D',

public class Problem5{
// Program to display number of correct and incorrect answers
public static void main(String []args){
char[] answerKeyFromChars = { 'D', 'B', 'D', 'C', 'C', 'D', 'A', 'E', 'A', 'D' } ;
char[][] studentsAnswersFromChars =
{ { 'A', 'B', 'A', 'C', 'C', 'D', 'E', 'E', 'A', 'D' },
{ 'D', 'B', 'A', 'B', 'C', 'A', 'E', 'E', 'A', 'D' },
{ 'E', 'D', 'D', 'A', 'C', 'B', 'E', 'E', 'A', 'D' },
{ 'C', 'B', 'A', 'E', 'D', 'C', 'E', 'E', 'A', 'D' },
{ 'A', 'B', 'D', 'C', 'C', 'D', 'E', 'E', 'A', 'D' },
{ 'B', 'B', 'E', 'C', 'C', 'D', 'E', 'E', 'A', 'D' },
{ 'B', 'B', 'A', 'C', 'C', 'D', 'E', 'E', 'A', 'D' },
{ 'E', 'B', 'E', 'C', 'C', 'D', 'E', 'E', 'A', 'D' }
} ;
int[][] studentResult= new int[8][2];
// initializing studentResult 2d array to zero where 0th location represents number of correct answers and 1st location represents number of incorrect answers
for(int i = 0; i
studentResult[i][0]= studentResult[i][1] = 0;
// Iterating through student 2D array
for(int i = 0; i
for(int j = 0; j
// checking student answers with key
if(studentsAnswersFromChars[i][j] == answerKeyFromChars[j])
studentResult[i][0]++;
else
studentResult[i][1]++;
}
}
// displaying student results
System.out.println("Student Results are:");
for(int i = 0; i
System.out.println("Student "+ i +" has "+ studentResult[i][0] +" correct "+"and "+ studentResult[i][1] + " wrong answers" );
}
}
}
Duplicate your previous project (lab 2 part 1-grade student exams) in Eclipse (or other IDE) First, create a method to grade the student exams gradeExams(). It takes 2 parameters: the answer key (single dimensional array) and the student answers (two dimensional array); displays the results; no return value (void). It should invoke a second method-gradeExam() that takes 2 parameters: the answer key (single dimensional array) and a single dimensional array for a single student's answers; displays the results; no return value (void) Once this works, create 2 more methods: getAnswerkey() and getStudentAnswers() which prompt the user for the corresponding information. getAnswerkey() returns a single dimensional array and getStudentAnswers() returns a two dimensional array. Note: getStudentAnswers() should take a single parameter specifying the number of questions (you can determine the value by looking at the array returned by getAnswerkey())-use this value to check that the user entered the correct number of answers for each student. Use your gradeExams() method to grade the user-supplied info. Recommendation: use Scanner (nextLine()) to read in the answer key as a single string (no spaces between answers) and the String method to convert it to an array of char
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
