Question: so the answer already given does not fix the issue. a picture of the correct square will be linked, but there should only be a

so the answer already given does not fix the issue. a picture of the correct square will be linked, but there should only be a top line of underscores, and the rest of the underscores will serves as as the bottom line of one line of squares as well as the top line for the next, and the vertical bars should not be double in between, only a single bar. public static char[][] getSquares(int rows, int columns){
char[][] square = new char[rows *2-1][columns *4-1];
// Draw the top line
for (int j =0; j columns *4-1; j++){
if (j %4==0|| j %4==2){
square[0][j]='';
} else {
square[0][j]='_';
}
}
// Draw the lines between squares and at the bottom
for (int i =1; i rows *2-1; i +=2){
// Draw the bottom line
for (int j =1; j columns *4-1; j +=4){
square[i][j]='_';
}
// Clear the top line for the next row
Arrays.fill(square[i],0, columns *4-1,'');
}
return square;
}
Right now this out puts this
____
|_||_||_||_|
____
|_||_||_||_|
____
|_||_||_||_|
____
|_||_||_||_|
should output this
correct picture of output is provided because the typing is hard
 so the answer already given does not fix the issue. a

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!