|
got this so far, but the square is not hollow, HELP!!
__________________________________________________ ______________
import java.util.Scanner;
public class HollowSquare2 {
public static void main(String[] args) {
Scanner keyInput = new Scanner(System.in);
int lo = 1;
int hi = 20;
int squareSize;
int rowCounter = 0;
int columnCounter = 0;
do
{
System.out.print("Enter the square size from 1 - 20: ");
squareSize = keyInput.nextInt();
}
while (squareSize >= lo ^ squareSize <= hi);
while (rowCounter < squareSize)
{
// Loop produce columns
while (columnCounter < squareSize)
{
if (rowCounter % 2 == 0)
{
System.out.print("X");
}
else
System.out.print("X");
columnCounter++;
}
// Increment and reset for the next row
rowCounter++;
columnCounter = 0;
System.out.println();
}
}
}
|