/*****************************************************************
 * Program:          Bingo
 *
 * Author:           Mark Rich   richm@cs.wisc.edu
 *
 * Completion Date:  March 5, 2000
 * 
 * Course:           CS 302, Spring 2000, Section 29 & 8
 * 
 * Compiler:         JDK 1.2.1
 * Platform:         Solaris
 *****************************************************************/

/**
 * This class implements the cool childhood song of BINGO.  Here,
 * we demonstrate the use of for loop and unbroken switch statements.
 *
 * Bugs known: None
 **/
class Bingo {

    public static void main (String[] args) {
	
	// The first for loop, to take care of each verse
	for (int claps = 0; claps <= 5; claps++) {

	    // These phrases are repeated verbatim every single time
	    // with only the verse number changing
	    System.out.println("VERSE " + (claps + 1));
	    System.out.println("");
	    System.out.println("There was a farmer who had a dog,");
	    System.out.println("And Bingo was his name-o.");
	    
	    // The second for loop, taking care of the clapping and
	    // spelling of BINGO
	    for (int times = 0; times < 3; times++) {

		// Uh oh, a switch without breaks!  The number of 
		// claps increases by one as the song progresses, 
		// therefore an acumulative switch statement 
		// in descending order fits the bill.
		switch(claps) {
		    case 5: System.out.print("CLAP! ");
		    case 4: System.out.print("CLAP! ");
		    case 3: System.out.print("CLAP! ");
		    case 2: System.out.print("CLAP! ");
		    case 1: System.out.print("CLAP! ");
		}

		// Another switch without breaks!  Now as the number
		// of verses increases, the letters are replaced with 
		// claps. We use another switch statement where one
		// less letter is printed out each time.
		switch(claps) {
		    case 0: System.out.print("B ");
		    case 1: System.out.print("I ");
		    case 2: System.out.print("N ");
		    case 3: System.out.print("G ");
		    case 4: System.out.print("O ");
		}

		// End of each inner loop, you should add on a 
		// comma for the English majors in the croud.
		System.out.println(",");
	    }

	    // Finally, we print out the last line of each verse.
	    System.out.println("And Bingo was his name-o.");
	    System.out.println("");
	}
    }
}

/**
 Sample output...

VERSE 1

There was a farmer who had a dog,
And Bingo was his name-o.
B I N G O ,
B I N G O ,
B I N G O ,
And Bingo was his name-o.

VERSE 2

There was a farmer who had a dog,
And Bingo was his name-o.
CLAP! I N G O ,
CLAP! I N G O ,
CLAP! I N G O ,
And Bingo was his name-o.

VERSE 3

There was a farmer who had a dog,
And Bingo was his name-o.
CLAP! CLAP! N G O ,
CLAP! CLAP! N G O ,
CLAP! CLAP! N G O ,
And Bingo was his name-o.

VERSE 4

There was a farmer who had a dog,
And Bingo was his name-o.
CLAP! CLAP! CLAP! G O ,
CLAP! CLAP! CLAP! G O ,
CLAP! CLAP! CLAP! G O ,
And Bingo was his name-o.

VERSE 5

There was a farmer who had a dog,
And Bingo was his name-o.
CLAP! CLAP! CLAP! CLAP! O ,
CLAP! CLAP! CLAP! CLAP! O ,
CLAP! CLAP! CLAP! CLAP! O ,
And Bingo was his name-o.

VERSE 6

There was a farmer who had a dog,
And Bingo was his name-o.
CLAP! CLAP! CLAP! CLAP! CLAP! ,
CLAP! CLAP! CLAP! CLAP! CLAP! ,
CLAP! CLAP! CLAP! CLAP! CLAP! ,
And Bingo was his name-o.

**/
