/**
 *                  Numbersign program to read in a
 *                  double and decide it is is positive, negative
 *                  or zero.
 *
 */

import uk.ac.ed.ph.sciprog.*;

public class NumberSign {
    public static void main(String args[]) {
	
	//                Make up the display panel to ask for one double

	Display panel = new Display("Number Sign");
	Input valueInput = new Input("Value", 0.0);
	panel.addInput(valueInput);


	//                  Start of loop reading from Display 
	//                  (see next sectio
	//
	while(true){

	    panel.waitForButtonPress();

	    double value = valueInput.getDouble();  // Read value


	    //               Start of if-else chain

	    if (value > 0) {               // Is number positive
		panel.printf("Number %.4g is POSITIVE\n",value);
	    }
	    else if (value < 0) {         // Is number negative
		panel.printf("Number %.4g is NEGATIVE\n",value);
	    }
	    else {                        // Both above fail, so MUST be zero
		panel.printf("Number %.4g is ZERO\n",value);
	    }
			
	}
    }
}
