import java.io.*;

/** Die Klasse "TestPostfix" demonstriert die Berechnung von mathematischen
Ausrücken in Postfix-Form mittels der Klasse "Postfix"
**/

class TestPostfix {
	public static void main( String [] args ) {

		Postfix postfix = new Postfix();

		// Ein paar Zeilen schreiben ...
		System.out.println( "Diese Klasse demonstriert die Berechnung von mathematischen Ausdrücken" );
		System.out.println( "in Postfix-Notation." );
		System.out.println( );
		System.out.println( "Fabian Wleklinski 1999" );
		System.out.println( );

		String example_i = new String ();

		float result = 0;

   		example_i = ("3 5 2 3 * 4 - + *");
		result = postfix.valueOf( example_i );
		System.out.println( "  Beispiel 1: " + example_i + "\n     ergibt den Wert:     " + result );

		example_i = ("2 4 + 6 8 + * 5 /");
		result = postfix.valueOf( example_i );
		System.out.println( "  Beispiel 1: " + example_i + "\n     ergibt den Wert:     " + result );

		System.out.println( );
		System.out.println( "Bitte geben Sie jetzt einen Ausdruck in Postfix-Notation ein:" );
		System.out.println( );

		BufferedInputStream input = new BufferedInputStream( System.in );
        char c = ' ';
        String s = new String();

        do {
            try {
     		    c = (char) input.read();
         	}
	     	catch (Throwable dummy) {
         	}

            if (c >= 32)
              s = s + c;
        } while (c >= 0x0d);
		result = postfix.valueOf( s );
		System.out.println( "  Beispiel 1: " + s + "\n     ergibt den Wert:     " + result );


	}
}