hi,
your coding is corect but need some changes.
The main things are "for loop" and "variable assignment".
1) value "Number" variable is taking from user, after that you are assigning another value to it.
remove that line
Number = 1 + ( int ) ( Math.random() * 10);
2) place if condition in for loop as below
before wtring any program first write the required steps,
take ur program as an example. read given problem line by
line then convert into coding.
Step 1. need two numbers, generated using Math.random
Ans)
int firstNumber = 1 + ( int ) ( Math.random() * 10);
int secondNumber = 1 + ( int ) ( Math.random() * 10);
Step 2. Aim of program to compare the product with user input
Ans) int product = firstNumber * secondNumber;
int input = JOptionPane.showInputDialog("How much is "
+firstNumber+" times "+secondNumber+" ? ");
Step 3. Program has to check for corect answer,
by asking input repeatedly
Ans) put one "counter" variable to count the number of times
user entered input.
whenever the number of iterations are not know,use "while" loop
finally the ouput code will look like below Hope this helps.
All The Best
[ March 22, 2005: Message edited by: sasi kala ]