import java.io.*;

 /**
  * The driver for Programming Assignment 1
  *
  * @author  Professor Elizabeth Adams, James Madison University
  * @version 1.0
  */
  public class DriverA
  {
  
    /**
     * The entry point of the application
     *
     * The application will be passed either 0 or 1 
     * command line arguments.  If there are no arguments,
     * the application will use standard input and standard
     * output.  If there is a single argument "-gui" then
     * the application will use a GUI
     *
     * @param args   The command line arguments
     */
     public static void main(String[] args)
     {
			ControllerA       myController;
			InputStream       theInputStream;
			NumericKeypad     theKeypad;
			OutputStream      theOutputStream;


				// Check to make sure there is a command line
				// argument AND if there is, process it
			if ((args.length > 0) && (args[0].equals("-gui"))) 
			{
	    			// Use the Graphical User Interface
	    		theKeypad 		 = new NumericKeypad();
	    		theInputStream  = theKeypad.getInputStream();
	    		theOutputStream = theKeypad.getOutputStream();
			}
			else  // use the standard input and standard output
			{
	  	       theInputStream    = System.in;
	    		 theOutputStream   = System.out;
			} 

					// Instantiate a Controller and run it
			myController = new ControllerA(theInputStream,
													 theOutputStream);
			myController.run();


					// Program is finished so 
					// shut everything down explicitly
			System.exit(0);
          

    } // end main

} // end Driver class