Driver’s License Exam The local driver’s license office has asked you to create an application that grades the written portion of the driver’s license exam.
Explanation:
import java.util.*;
class DriverExam{
char[] answer = new char[]{ 'B','D','A','A','C','A','B','A','C','D','B','C','D','A','D','C','C','B','D','A'};
int correct=0,inCorrect=0;
int[] missed = new int[20];
boolean passed(){
if(this.correct >= 15){
return true;
}
return false;
}
int totalCorrect(){
return this.correct;
}
int totalIncorrect(){
return this.inCorrect;
}
int[] questionsMissed(){
return this.missed;
}
}
public class Main
{
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
System.out.println("Input : A,B,C,D");
System.out.println("Note : Any other inputs will result in skipping that question");
DriverExam exam = new DriverExam();
int i,missedIndex=0;
for(i=0;i<20;i++){
System.out.print("Answer "+(i+1)+" : ");
char check = in.next().charAt(0);
if(exam.answer[i]==check){
(exam.correct)++;
}