//© A+ Computer Science - www.apluscompsci.com //Name - //Date - //Class - //Lab - class BoxWord { private String word; public BoxWord() { setWord ( "" ); } public BoxWord(String s) { setWord ( s ); } public void setWord(String w) { word = w; } public String toString() { if ( word.length () < 2 ) { return word; } String output = new String (); output += word + "\n"; for ( int i = 1; i < word.length () - 1; i++ ) { output += word.charAt ( i ); for ( int j = 0; j < word.length () - 2; j++ ) output += " "; output += word.charAt ( word.length () - i - 1 ) + "\n"; } StringBuffer buffer = new StringBuffer ( word ); buffer.reverse (); output += buffer.toString () + "\n"; return output; } }