// Decorations.java Copyright (c) 2004 Kari Laitinen // http://www.naturalprogramming.com // 2004-10-09 File created. // 2004-02-05 Last modification. class Decorations { static void multiprint_character( char character_from_caller, int number_of_times_to_repeat ) { int repetition_counter = 0 ; while ( repetition_counter < number_of_times_to_repeat ) { System.out.print( character_from_caller ) ; repetition_counter ++ ; } } static void print_text_in_decorated_box( String text_from_caller ) { int text_length = text_from_caller.length() ; System.out.print( "\n " ) ; multiprint_character( '=', text_length + 8 ) ; System.out.print( "\n " ) ; multiprint_character( '*', text_length + 8 ) ; System.out.print( "\n **" ) ; multiprint_character( ' ', text_length + 4 ) ; System.out.print( "**\n ** " + text_from_caller + " **\n **" ) ; multiprint_character( ' ', text_length + 4 ) ; System.out.print( "**\n " ) ; multiprint_character( '*', text_length + 8 ) ; System.out.print( "\n " ) ; multiprint_character( '=', text_length + 8 ) ; System.out.print( "\n " ) ; } public static void main( String[] not_in_use ) { String first_text = "Hello, world." ; print_text_in_decorated_box( first_text ) ; print_text_in_decorated_box( "I am a computer program written in Java." ) ; } }