oops sorry I missed that on my part, I've changed it to the correct arrayAnswers[] since my user answers are saved to the arrayAnswers[] (my key is actually name answerKey[i] and it's not used in this method).
Did you mean that my retry portion wouldn't return an updated answer because I was missing "arrayAnswers[index] = userInput.charAt(0);" within that loop? I've changed it but the program now prompts for an answer, regardless of the answer it will tell me it's invalid, then it prompts for answer again but it's the wrong answer #
example
1. prompt answer #1
2. input is 'a'
3. user input = invalid, <=== this wrong should validate and move to next prompt
4. prompts user again for input but this time it's for quiz answer 2 skipping gathering the correct answer 1 altogether <===this is wrong as well
public static char[] getAnswers(char arrayAnswers[ ])
{
String userInput;
for (int index = 0; index < arrayAnswers.length; index++) {
userInput= JOptionPane.showInputDialog("Enter the answer to question " + (index +1) + ":");
arrayAnswers[index] = userInput.charAt(0);
while (arrayAnswers[index]!=('a') && (arrayAnswers[index]!=('b')&& arrayAnswers[index]!=('c')&&(arrayAnswers[index]!=('d'))));
{
JOptionPane.showMessageDialog(null, "Please enter a valid letter!");
userInput= JOptionPane.showInputDialog("Enter the answer to question " + (index +1) + ":");
arrayAnswers[index] = userInput.charAt(0);
}
}
return arrayAnswers;
}