/** * This class can be used to display various childrens' songs. * * @author Dave Reed * @version 9/10/09 */ public class Singer { /** * Constructor for objects of class Singer */ public Singer() { } /** * Displays a verse of "OldMacDonald Had a Farm" * * @param animal animal name for this verse * @param sound sound that the animal makes */ public void oldMacDonaldVerse(String animal, String sound) { System.out.println("Old MacDonald had a farm, E-I-E-I-O."); System.out.println("And on that farm he had a " + animal + ", E-I-E-I-O"); System.out.println("With a " + sound + "-" + sound + " here, and a " + sound + "-" + sound + " there, "); System.out.println(" here a " + sound + ", there a " + sound + ", everywhere a " + sound + "-" + sound + "."); System.out.println("Old MacDonald had a farm, E-I-E-I-O."); System.out.println(); } /** * Displays the song "OldMacDonald Had a Farm" */ public void oldMacDonaldSong() { this.oldMacDonaldVerse("cow", "moo"); this.oldMacDonaldVerse("duck", "quack"); this.oldMacDonaldVerse("sheep", "baa"); this.oldMacDonaldVerse("dog", "woof"); } /** * Displays a verse of "100 bottles of ??? on the wall" * * @param numBottles the number of bottles in the verse * @param drink the type of drink */ public void bottleVerse(int numBottles, String drink) { System.out.println(numBottles + " bottles of " + drink + " on the wall."); System.out.println(numBottles + " bottles of " + drink + "."); System.out.println("Take one down, pass it around..."); System.out.println((numBottles-1) + " bottles of " + drink + " on the wall."); System.out.println(); } /** * Displays the song "100 bottles of Dew on the wall" * * @param numBottles the number of bottles in the verse * @param drink the type of drink */ public void bottleSong() { for (int b = 100; b > 0; b--) { this.bottleVerse(b, "Dew"); } } /** * Displays a verse of "The wheels on the bus" * * @param busPart part of the bus referenced in this verse * @param partAction the action that part performs */ public void busVerse(String busPart, String partAction) { System.out.println("The " + busPart + " on the bus go " + partAction + ","); System.out.println(" " + partAction + ", " + partAction + "."); System.out.println("The " + busPart + " on the bus go." + partAction + ","); System.out.println(" all through the town."); System.out.println(); } /** * Displays the song "The wheels on the bus" */ public void busSong() { this.busVerse("wheels", "round and round"); this.busVerse("wipers", "swish-swish-swish"); this.busVerse("doors", "open and closed"); this.busVerse("babies", "waah waah waah"); this.busVerse("mommies", "shhh shhh shhh"); } }