I'm new to Greenfoot
Array is declared as a global variable
the program should not repeat the same question
1x2 and 2x1 is not the same
and also i can't seem to store the answer in the array. this is the error i get
java.lang.ArrayIndexOutOfBoundsException: 10
int[] userAnswer;
public void levelOne()
{
do{
tableSelection = JOptionPane.showInputDialog("Select the multiplication table you wish to practice \nBetween 1 - 12");
timesTable = Integer.parseInt(tableSelection);
}while(timesTable <=0 || timesTable >=13);
for(int i =0;i<11;i++) {
userAnswer = new int[10];
questionNumber = Greenfoot.getRandomNumber(12);
question = JOptionPane.showInputDialog(timesTable + " x " + questionNumber + " = ?" );
userAnswer[i] = Integer.parseInt(question);
}
for(int i=0;i<11;i++) {
System.out.println(userAnswer[i]);
}
}
}
