import java.util.*;

/**
 * EightBallDriver - This one does no validation 
 *
 * @author Michael Norton & Nancy Harris
 * @version V1 Oct 17, 2008
 */
public class EightBallDriverV2
{
	public static void main( String[] args )
	{
		// declarations
		EightBall ball;
		Scanner scan;
		String question;	 // 8 Ball question
		String cQuestion;  // continuation question
		
		// instantiations
		ball = new EightBall();
		scan = new Scanner( System.in );
		
		// do 8 ball stuff
		System.out.print( "Ask a question of the Magic 8 Ball: " );
		question = scan.nextLine(); 		
		
		// validate question - > 0, <= 60, ends with ?
		while (question.length() == 0 || question.length() > 60 || 
			question.charAt(question.length() - 1 ) != '?')
		{
			// choose one error message
			if (question.length() == 0)
				System.out.println("An empty message is not allowed.");
			else if (question.length() > 60)
				System.out.println("Your message is too long.");
			else if (question.charAt(question.length() - 1) != '?')
				System.out.println("You must use a question.");
			else
				System.out.println("This cannot happen -- ERROR");
			
			// reprompt
			System.out.print( "Ask a question of the Magic 8 Ball: " );
			question = scan.nextLine();
		} // end while 		
		
		// echo question and print the answer
		System.out.println( "Your question: " + question);
		System.out.println( "Your answer:   " + ball.shakeEightBall01() );
				
	} // method main

} // class EightBallDriver