/*******************************************************************************
Program:          Magic8BallTest

Author:           Rebecca Hasti, hasti@cs.wisc.edu
                  copyright 2000, all rights reserved
Course:           CS 302

Compiler:         Metrowerks CodeWarrior (JDK 1.2)
Platform:         Windows (NT 4.0 or 95 or 2000)
*******************************************************************************/

import javabook2.*;

/**
 * This program prompt the user for a yes or no question and then uses a magic
 * 8 ball object to get an answer, which is then displayed to for the user.
 *
 * Bugs:	none known
 **/
class Magic8BallTest {

	public static void main(String args[]) {
	
		MainWindow mainWindow;        // the main frame for the program
		InputBox inputBox;            // gets the question from the user
		MessageBox messageBox;        // displays the results
		String question;              // the question the user asks
		Magic8Ball magic8Ball;        // the magic 8 ball
		
		// Create the necessary objects
		mainWindow = new MainWindow("Welcome to the Magic 8 Ball!");
		inputBox = new InputBox(mainWindow);
		messageBox = new MessageBox(mainWindow);
		magic8Ball = new Magic8Ball(); 
		mainWindow.show();
		
		// Tell the user about the magic 8 ball
		messageBox.show("Ask the magic 8 ball a question and it will predict " +
		                "the future!!");
		                
		// Ask the magic 8 ball a question
		question = inputBox.getString("Please ask a yes-or-no question:");
		magic8Ball.askQuestion(question);
		
		// Display the magic 8 ball's reply
		messageBox.show("The magic 8 ball says:  " +magic8Ball.giveAnswer());

	} end method main

} // end class Magic8BallTest
