/**  ReadVariable:   Simple program to read an String/double/int/boolean
 *                    and print it out again using the 
 *                    local Display class.
 *
 */

import uk.ac.ed.ph.sciprog.*;                   // Import Display classes


public class ReadVariable{                      // Define main class
    public static void main(String args[]){     // main program start

    //                 Setup the Display 

    Display panel = new Display("A simple input/output program");
    
    //                String input

    Input stringInput = new Input("Give a String value ","Hello World");
    panel.addInput(stringInput);

    //                 int input

    Input intInput = new Input("Give an integer", 10);
    panel.addInput(intInput);

    //                  double input

    Input doubleInput = new Input("Give a double", 3.14159);
    panel.addInput(doubleInput);

    //                  boolean input (see next section)
 
    Input booleanInput = new Input("True of False",false);
    panel.addInput(booleanInput);


    //                  Loop ``for ever'' reading + writing   
    //                  See next section on loops for details.
    while( true ){

	 //             wait until ready, 
	panel.waitForButtonPress();

	//             read the string and print it
	String sValue = stringInput.getString();
	panel.println("The strings is : " + sValue);

	//             Read the integer and print it.
	int iValue = intInput.getInt();
	panel.println("Value of integer is : " + iValue);


	//              Read the double and print in
	double dValue = doubleInput.getDouble();
	panel.println("Value of the double is : " + dValue);

	//            Read the boolean and print it
	boolean bValue = booleanInput.getBoolean();
	panel.println("Value of the boolean is : " + bValue);
	
    }                            
  }
}
