\Java
Squares.java
//********************************************************************
//
// Squares.java
//
//********************************************************************
//
// Program Description and Design Overview:
//
//
// Input Requirements:
//
//
// Output Requirements:
//
//
//
// Program Preconditions:
//
//
//********************************************************************
import cs1.Keyboard;
public class Squares
{
//-----------------------------------------------------------------
// A comment that must be replaced by comment(s) describing the // program's main method.
//-----------------------------------------------------------------
public static void main (String[] args)
{
int height, width, countW = 0, countH = 0;
System.out.print("Enter an odd integer for width of a box: ");
width = Keyboard.readInt(); // input for width
System.out.print("Enter an odd integer for height of a box: ");
height = Keyboard.readInt(); // input for height
// loop to print out first line of the box
while(width != countW)
{
System.out.print("o");
countW++;
}
countW = 0;
System.out.println();
// loop for height of the box
while((height - 2) != countH)
{
System.out.print("o");
// loop print out spaces in the middle of the box
while((width - 2) != countW)
{
System.out.print(' ');
countW++;
}
countW = 0;
System.out.println("o");
countH++;
}
countW = 0;
// loop to print out last line of the box
while(width != countW)
{
System.out.print("o");
countW++;
}
System.out.println();
} //end main
} // end class Squares