import java.util.*; // Test whether three numbers a, b, c entered by the user // form a pythagorean triple, that is a^2 + b^2 == c^2 class drawBox { public static void main(String[] args) { int height = 0, width = 0; Scanner in = new Scanner(System.in); // Ask for height and width System.out.print("Height: "); height = in.nextInt(); System.out.print("Width: "); width = in.nextInt(); // Draw the box drawBox(height, width); } static void drawBox(int height, int width) { drawTopOrBottom(width); drawSides(height, width); drawTopOrBottom(width); } static void drawTopOrBottom(int width) { for(int i = 0; i < width; i++) { System.out.print("*"); } System.out.println(""); } static void drawSides(int height, int width) { for(int i = 0; i < (height-2); i++) { System.out.print("*"); for(int j = 0; j < (width-2); j++) { System.out.print(" "); } System.out.println("*"); } } }