// Print the Old MacDonald song // Beth Katz - April 2009 public class MacD0 { public static void main(String[] args) { printSong("cow", "moo"); printSong("dog", "woof"); printSong("horse", "neigh"); printSong("hen", "cluck"); printSong("pig", "oink"); } // print the song with the given animal and sound public static void printSong(String animal, String sound) { System.out.println("Old MacDonald had a farm"); eieio( ); System.out.println("and on his farm, he had a " + animal); eieio( ); System.out.println("with a " + sound + " " + sound + " here"); System.out.println("and a " + sound + " " + sound + " there"); System.out.println("here a " + sound + " there a " + sound); System.out.println("everywhere a " + sound + " " + sound); System.out.println("Old MacDonald had a farm"); eieio( ); System.out.println( ); } // print the special letters public static void eieio( ) { System.out.println("E-I-E-I-O"); } }