-
whats a helper class?
ive gotta write a program which has a JLabel and JText etc. fileds which is easy i can do that. the program is a 2 digit multiplication game,
i.e.
1 * 2 = 2 [JTextField]
[JLabel] Correct or incorrect
ok next
where 1 and 2 are numbers generated by the helper class but what is it and where do i get it? this helper class generates two numbers and the user entyers the answer and it says correct or not. if its correct then the user clicks next and a new problem is generated by the helper class but how do i get it?
-
I take it this is an assignment? By "helper class" the instructor probably just means a seperate Class you write that takes care of the creation of random integers. So in order to get the integers into your JTextField, they first have to be created by this other Class you write for that purpose.
-
so how do u vreate a class that generates 2 random numbers between 1 and 10?
-
The easiest way is probably java.lang.Math.random(). I'll let you figure out the details.
http://java.sun.com/j2se/1.4.2/docs/api/