2
Contributors
3
Replies
4
Views
6 Years
Discussion Span
Last Post by javaAddict
0

When was this project assigned to you? How much time was it given to your class to finish it and when do you have to submit it?

0

it's just gave it to us yesterday and I have to submit it after 36 hours .

0

Start with small steps.
First create the class, the constructor and start working on the first method that it is described.
All you have to do is fill the 9x9 array with numbers. Use the notes hat you have. You can use the Random class to generate random numbers.

You can have a 2D array of Strings with all of its elements to have the value:
"123456789".
When you put a number to a cell, use the replaceAll method of the String class in order to remove that number from the elements that are at the same row, column and "smaller square".

If you put at [0][0] = 1, then remove from all the cels: [0] the 1, as well as from [j][0] and the upper left square. Then select a random number for the next cell and loop the array until all the cells have one number. The random numbers must be selected based on the numbers that they already have.

You can have the random class return not a random number but a random position of the number. If one cell has this value: "1245679" then its length is: 7, So select a random number from 0 to 6 and put to that cell the number of that position.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.