Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Advances In Spatial And Temporal Databases 11th International Symposium Sstd 2009 Aalborg Denmark July 8 10 2009 Proceedings Lncs 5644

Authors: Nikos Mamoulis ,Thomas Seidl ,Kristian Torp ,Ira Assent

2009th Edition

3642029817, 978-3642029813

More Books

Students also viewed these Databases questions