1. import java.util.Scanner;
  2. 
  3. /**
  4. * Lab3.java
  5. * @author Jose M Vidal <jmvidal@gmail.com>
  6. * Created on Jan 30, 2012
  7. *
  8. */
  9. 
  10. public class Lab3 {
  11. 
  12. /**
  13. * @param args
  14. */
  15. public static void main(String[] args) {
  16. Scanner keyboard = new Scanner(System.in);
  17. System.out.print("Enter total size:");
  18. int size = keyboard.nextInt();
  19. System.out.print("Enter frame width:");
  20. int width = keyboard.nextInt();
  21. for (int row = 0; row < size; row++) {
  22. for (int col = 0; col < size; col++) {
  23. if (row < width || row >= (size - width))
  24. System.out.print("*");
  25. else if (col < width || col >= (size - width))
  26. System.out.print("*");
  27. else
  28. System.out.print(" ");
  29. }
  30. System.out.println("");
  31. }
  32. }
  33. 
  34. }