以下の課題について質問です。
The local Driver's license office has asked you to write a program that grades the written portion of the driver's license exam. The exam has 20 multiple choice questions. Here are the correct answers:
1.B 2.D 3.A 4.A 5.C 6.A 7.B 8.A 9.C 10.D 11.B 12.C 13.D 14.A 15.D 16.C 17.C 18. B 19. D 20. A
A student must correctly answer 15 of 20 questions to pass the exam.
Write a class named DriverExam that holds the correct answers to the exam in array field. The class should also have an array field that holds the student's answers.The class should have the following methods.
・passed. Return true if the student passed the exam, or false if the student failed
・totalCorrect. Returns the total number of correctly answered questions
・totalIncorrect. Returns the total number of ncorrectly answered questions
・questionMissed. An int array containing the question numbers of the question that the student missed
Demonstrates the class in a complete program that ask the user to enter a student's answer, and then displays the results returned form the DriverExam class7s mathods```
import
1 2 3public class DriverExam 4{ 5 public static void main(String[] args) 6 { 7 8 //Create an ArrayList to hold some names. 9 ArrayList<String> nameList = new ArrayList<String>(); 10 11 //Add some names to the ArrayList 12 char[] correct = { 'B', 'D', 'A', 'A', 'C', 'A', 'B', 'A', 'C', 'D', 'B', 13 'C', 'D', 'A', 'D', 'C', 'C', 'B', 'D', 'A' }; 14 char[] respose = new char[20]; 15 int numCorrect[]; 16 int numIncorrect[]; 17 int[] Questioned; 18 boolean passed; 19 for (int a = 0; a < respose.length ; a++) 20 { 21 Stdout.println (); 22 23 passed = examPassed (response, correct); 24 numCorrect = totalCorrect (respose, correct); 25 numIncorrect = totalIncorrect (respose, numCorrect); 26 QuestMissed = questionsMissed (response, correct); 27 28 if (passed) 29 Stdout.print(" You passed "); 30 else 31 Stdout.print(" You did't pass!"); 32 33 Stdout.print(" Below are the details of your marked exam: "); 34 Stdout.print(" correct questions: " + numCorrect); 35 Stdout.print(" insorrect question: " + numIncorrect); 36 37 if (QuestMissed.length > 0); 38 { 39 Stdout.print(" QuestionMissed: "); 40 41 for (int a = 0 ; a < QuestMissed.length ; a++) 42 { 43 Stdout.print (QuestMissed.length [a]); 44 Stdout.print(" "); 45 } 46 } 47 } 48 private static int totalCorrect (char[] resp, char[] ans) ここにエラーが出ます。 49 { 50 int totalCor = 0; 51 for (int a = 0 ; a < resp.length ; a++) 52 { 53 if (resp [a] == ans [a]) 54 totalCor++; 55 } 56 return totalCor; 57 58 } 59 private static int[] toalIncorrect ( char[] resp, int right) 60 { 61 return (resp.length - right); 62 } 63 public static int[] questionMissed ( char[] resp, char[] ans); 64 int[] missedQuestions = {}; 65 66 if (sizeArray < 1) 67 return missedQuestions; 68 69 else 70 { 71 missedQuestions = new int [sizeArray]; 72 int position = 0; 73 for (int x = 0 ; x < sizeArray]; 74 { 75 if (resp [x] != ans [x]) 76 { 77 missedquestions [position] = (x + 1); 78 posotion = position + 1; 79 } 80 } 81 82 private static boolean examPassed (char[] resp, char[] ans) 83 { 84 int cor; 85 boolean flag = false; 86 cor = totalCorrect (resp, ans); 87 if (cor >= 15) 88 flag = true; 89 90 return flag; 91 } 92 } 93ここに言語を入力 94コード