I have an assignment for my beginners java course (which is an online course). I have to drill a student on 20 multiplication tables (random numbers 1-20) and then once all 20 questions are answered, I must give a grade.
I've been using my text (Intro to Java Programming), and looked through various sites on the web to try to better explain different ways to accomplish this. So far this is what I come up with. This code has been written from using the lessons in my text. The code compiles, but I get a number of errors. My biggest problem is that it does not cycle through 20 problems. It only goes through one. Thus the rest of the program doesnt execute, and I obviously cant get a grade. Some assistance and even explinations would be helpful! Thanks

import javax.swing.JOptionPane;
public class multDrill {
public static void main(String[] args) {
int count = 0; //count number problems
int score = 0; //begin count number right
while (count < 21){
//generate two random numbers
int number1 = (int)(Math.random(1) * 20);
int number2 = (int)(Math.random(1) * 20);
}
//give mult problem to student
String answerString = JOptionPane.showInputDialog
("What is" + number1 + " * " + number2 + " ? ");
int answer = Integer.parseInt(answerString);
//correct or incorrect
String replyString;
if (number1 * number2 == answer){
replyString = "Good Job";
score++;
}
else
replyString = "Incorrect";
JOptionPane.showMessageDialog(null, replyString);
//increase count by 1
count++;
}
{
if (score >= 18)
grade = 'A';
else if (score >= 16)
grade = 'B';
else if (score >= 14)
grade = 'C';
else if (score >= 12)
grade = 'D';
else
grade = 'F';
}
JOptionPane.showMessageDialog(null,
"Your grade is" + grade + );
}
}