I don't know how and where to insert the score got by the user. Also, remove the repetition of asking another answer if they got it wrong. I'm kinda new to this so please help me. Thank you!
import java.util.Scanner;
public class GameQuiz {
static final int QUESTION = 0;
static final int ANSWER = 1;
static final int CHOICES = 2;
static String [][] QA = {
{"1. Q1?", "A",
"A. Option 1", "B. Option 2", "C. Option 3"},
{"2. Q2?", "B",
"A. Option 1", "B. Option 2", "C. Option 3"},
{"3. Q3?", "C",
"A. Option 1", "B. Option 2", "C. Option 3"},
{"4. Q4?", "B",
"A. Option 1", "B. Option 2", "C. Option 3"},
{"5. Q5?", "A",
"A. Option 1", "B. Option 2", "C. Option 3"}};
public static void main(String args[]) {
Scanner input = new Scanner(System.in);
for (int QIndex = 0; QIndex < QA.length; QIndex++) {
printQuestion(QIndex);
do {
System.out.print("Your Answer: ");
}
while (!CorrectAnswer(QIndex, input.next().charAt(0)));
}
}
static boolean CorrectAnswer(int QNum, char Answer) {
boolean rightAnswer = (Answer + "").equalsIgnoreCase(QA[QNum][ANSWER]);
System.out.println(rightAnswer ? "Correct!\n" : "Incorrect!");
return rightAnswer;
}
}