import java.util.*;

/**
 * EightBallDriver - This one does no validation 
 *
 * @author Michael Norton & Nancy Harris
 * @version V1 Oct 17, 2008
 */
public class EightBallDriverV3
{
	public static void main( String[] args )
	{
		// declarations
		EightBall ball;
		Scanner scan;
		String question;	 // 8 Ball question
		String cQuestion;  // continuation question
		boolean flag;		 // true if question is good
		
		// instantiations
		ball = new EightBall();
		scan = new Scanner( System.in );

		
		// do 8 ball stuff
		do
		{
			flag = true;
			System.out.print( "Ask a question of the Magic 8 Ball: " );
			question = scan.nextLine(); 		
		
			// validate question - > 0, <= 60, ends with ?

			// choose one error message
			if (question.length() == 0)
			{
				System.out.println("An empty message is not allowed.");
				flag = false;
			}
			else if (question.length() > 60)
			{
				System.out.println("Your message is too long.");
				flag = false;
			}
			else if (question.charAt(question.length() - 1) != '?')
			{
				System.out.println("You must use a question.");
				flag = false;
			}
			// else no else in this case. 
			
		}while (!flag); // if true, then exit and answer the question 		
		
		// echo question and print the answer
		System.out.println( "\nYour question: " + question);
		System.out.println( "Your answer:   " + ball.shakeEightBall01() );
				
	} // method main

} // class EightBallDriver