[Solved]Java Need Help Displaying Numbers 10×10 Array Instructions See User Inputs Guesses X Y Coo Q37223968
**JAVA**: I need help displaying numbers into a10x10 array. Instructions: 


As you can see, as the user inputs guesses (x,y coordinates) thedistance of their input from the randomly placed item should beplaced into the appropriate coordinates of the array. Here is thecode I have for printing out the empty array (which worksperfectly), so it just needs to be modified to add in those numbersas the user guesses them.
—————————————————————————————————————————————————————————————————————————-
private void displayGrid() {// display empty 10×10 grid
System.out.printf(“%7d%7d%7d%7d%7d%7d%7d%7d%7d%7dn”,1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
for (int row = 0; row <grid.length; row++) {
System.out.println(“———————————————————————–“);
for (int times = 1; times<= 3; times++) {
if (times == 2) {
if(row <= 8)
System.out.println((row + 1) + ” | | || | | | | | | |”);
else
System.out.println((row + 1) + ” | | || | | | | | | |”);
} else {
System.out.println(” | | | | | | | | || |”);
} if (row == -1) {
return;
} else {
System.out.print(“”);
}
}
}
System.out.println(“———————————————————————–“);
} // end displayGrid()
This year, I am in the mood to create a new game, which I am calling Triangulate. The goal of this game it to find an item that has been randomly hidden on a 10X10 square grid using only 4 tries. To aid the player, you will provide feedback on how close their selection is to the item. The game starts by randomly placing the item in the grid and then displaying an empty 10×10 grid (see below) 237910 1 101 The player is then prompted for a move Enter your move (x,y): 3,4 This input should be checked to see if it is in the proper format, within bounds, and not already played. If it meets the criteria, then the user should be either told they won (if they found the item), lost (if they have used up their 4 turns), or a new grid should be displayed with the distance to the item shown in the position they selected. (see below 1 2 35710 101 This processcontinues until either they run out of moves or they find the item. To make the game work, you will need to store previous moves and implement a distance function. I suggest using a 10X10 array of integers, which is initially filled with a sentinel value like -1, to store the previous moves. When the user makes a move, place the calculated distance in the array to make it easier to print. When printing only print values in the grid if the value is not equal to -1. This is also an easy way to check if someone has already tried the position. I used the following function to compute distance: distance(xl,yl,x2,y2) – Vx1-x2)(y1 -y2) where (xl,yl) are the items location, (x2,y2) is the user’s guess and [z] is the floor of z. When I placed my item at (7,8), the distances look like this… 1 23 4 5 6 7 8 9 10 2 87 76 6 6 6 66 6 3 776 5 5 55 5 55 4 7 6 55 4 4 4445 5 65 5 43 33 3 3 4 6 65 43 2 2 2 223 7 65 43 2 1 1 1 23 8 6 5 43 2 1 1 23 10 65 4 3 2 22 2 2 3 This is the hardest programming project I have ever given you. Don’t hesitate to talk to either myself or your TA if you run into trouble. You will be graded on proper use of class structure, documentation, the operation of the software, and your coding style Keep in mind the things I’ve talked about in the lectures concerning use of constants, classes, methods, etc. Submit your assignment as a single ZIP file (no RAR files) to Harvey by the due date Show transcribed image text This year, I am in the mood to create a new game, which I am calling Triangulate. The goal of this game it to find an item that has been randomly hidden on a 10X10 square grid using only 4 tries. To aid the player, you will provide feedback on how close their selection is to the item. The game starts by randomly placing the item in the grid and then displaying an empty 10×10 grid (see below) 237910 1 101 The player is then prompted for a move Enter your move (x,y): 3,4 This input should be checked to see if it is in the proper format, within bounds, and not already played. If it meets the criteria, then the user should be either told they won (if they found the item), lost (if they have used up their 4 turns), or a new grid should be displayed with the distance to the item shown in the position they selected. (see below
1 2 35710 101 This processcontinues until either they run out of moves or they find the item. To make the game work, you will need to store previous moves and implement a distance function. I suggest using a 10X10 array of integers, which is initially filled with a sentinel value like -1, to store the previous moves. When the user makes a move, place the calculated distance in the array to make it easier to print. When printing only print values in the grid if the value is not equal to -1. This is also an easy way to check if someone has already tried the position. I used the following function to compute distance: distance(xl,yl,x2,y2) – Vx1-x2)(y1 -y2) where (xl,yl) are the items location, (x2,y2) is the user’s guess and [z] is the floor of z. When I placed my item at (7,8), the distances look like this…
1 23 4 5 6 7 8 9 10 2 87 76 6 6 6 66 6 3 776 5 5 55 5 55 4 7 6 55 4 4 4445 5 65 5 43 33 3 3 4 6 65 43 2 2 2 223 7 65 43 2 1 1 1 23 8 6 5 43 2 1 1 23 10 65 4 3 2 22 2 2 3 This is the hardest programming project I have ever given you. Don’t hesitate to talk to either myself or your TA if you run into trouble. You will be graded on proper use of class structure, documentation, the operation of the software, and your coding style Keep in mind the things I’ve talked about in the lectures concerning use of constants, classes, methods, etc. Submit your assignment as a single ZIP file (no RAR files) to Harvey by the due date
Expert Answer
Answer to **JAVA**: I need help displaying numbers into a 10×10 array. Instructions: As you can see, as the user inputs guesses (x… . . .
OR

