// CS101 // // OldMacDonald.java // Prints out the lyrics for the song (incomplete) public class OldMacDonald { // the main method public static void main(String[] args) { System.out.println("Old MacDonald had a farm,"); printChorus(); System.out.println("And on his farm he had some pigs,"); printChorus(); System.out.println("With a oink-oink here, oink-oink there,"); System.out.println("here a oink, there a oink,"); System.out.println("everywhere a oink-oink."); System.out.println(); // test a method that takes parameters printAnimalSound("chicken", "cluck"); printAnimalSound("pig", "oink"); } // print chorus (no paramaters since it is always the same) public static void printChorus() { System.out.println("E-I-E-I-O."); } // a method with two parameters public static void printAnimalSound(String animal, String sound) { System.out.println("A " + animal + " says " + sound + "."); } }