preferably by creating a class which generates random numbers and then calling on it in the main method......The program below is in the main method.
//Programming the LuckyDip of the first line to produce 6 random numbers
void LuckyDip1_actionPerformed(ActionEvent e) {
int[] array = new int [6];
int[] tmp = new int[1];
int count = 0;
luckyNum = 1 + (int)(Math.random()*49);
array [count] = luckyNum;
count++;
luckyNum = 1 + (int)(Math.random()*49);
array [count] =luckyNum;
count++;
luckyNum = 1 + (int)(Math.random()*49);
array [count] =luckyNum;
for (int i=array.length; i>1;i++)
{
for (int j=1; j
{
if (array[j-1]>array[j])
{
int temp=array[j-1];
array[j-1]=array[j];
array[j]=temp;
}
}
jTextField1.setText(""+array[0]
2007-07-26
02:06:15
·
1 answers
·
asked by
Night_nurse
2
in
Computers & Internet
➔ Programming & Design