/**
   This program prints strings in boxes.
*/
public class Boxes
{
   public static void main(String[] args)
   {
      boxString("Hello");
      boxString("World");
   }

   /**
      Prints a string in a box.
      @param str the string to print
   */
   public static void boxString(String str)
   {
      int n = str.length();
      // Print the top row
      for (int i = 0; i < n + 2; i++) { System.out.print("-"); }
      System.out.println();
      System.out.println("!" + str + "!");
      // Print the bottom row
      for (int i = 0; i < n + 2; i++) { System.out.print("-"); }
      System.out.println();
   }
}
