java Loop program to place distinct value in a row, column and diagonal

Welcome to the Java Programming Forums

The professional, friendly Java community. 21,500 members and growing!

The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.

java Loop program to place distinct value in a row, column and diagonal

Hi,

I'm novoice to java. I'm trying a program for place 8 X’s on the board with 64 boxes(8*8 matrix) in such a way that:
1. there is at the most one X in any box
2. no two X’s are on the same row
3. no two X’s are on the same column
4. no two X’s are on the same diagonal
Write a Java application program that takes a brute-force approach using random
number generation to find one such placement and display it on the screen.
Basically, the program will do the following until it finds a solution:
1. set n = 1
2. For n =1 to 8
a. check if there are any other boxes where an X can be placed without violating any
of the constraints that we have specified above. if no, go to step 1
b. choose a random box to place the nth X
c. find out if placing an X in that box violates any of the constraints that we have
specified above.
If no, place the nth X in that box, increment n by 1.

Below is the code, that i have tried so far...Please help me to finish this program as soon as possible...Please Help me...It's very urgent