Here is the generation code, everything has been instantiated correctly and works. I put the print lines in to test it and matrix[i] is always equal to zero. It needs to be in 10 columns hence the new line.Count is initially set to zero and size is the size of the array, input from the keyboard while running. I believe the problem is that display is getting set but the value of matrix[i] is not remaining stored so that I can search it, which I have to do later in the program. Any help with this is much appreciated.
public String generate()
{
while (count <size)
{
for (int i =0; i<10; i++)
{
System.out.println(i);
System.out.println(matrix[i]);
matrix [i] = gen.nextInt((max-min)+1)+min;
display = display + matrix [i] + "\t";
count++;
if (count == size)
break;
}
display = display + "\n";
}
System.out.println(matrix);
return display;
}
Aucun commentaire:
Enregistrer un commentaire