import java.util.Scanner;
import java.util.Deque;

/**
 * A program to read and evaluate postfix expressions.
 *
 * @author Mark Young (A00000000)
 */
public class Postfix {

    public static final Scanner KBD = new Scanner(System.in);

    public static void main(String[] args) {
        String line;

        printIntroduction();

        while (!(line = getExpression()).isEmpty()) {
            System.out.println("Result: " + process(new Scanner(line)));
            System.out.println();
        }
    }

    /**
     * Print an introduction for the program.
     */
    private static void printIntroduction() {
        System.out.println("\n"
                + "This program reads and evaluates postfix expressions.\n\n"
                + "Enter your expression at the >>> prompt. "
                + "Leave it blank to quit.\n");
    }

    /**
     * Prompt for and read a postfix expression.
     *
     * @return the postfix expression (possibly empty)
     */
    private static String getExpression() {
        System.out.print(">>> ");
        return KBD.nextLine();
    }

    /**
     * Process a postfix expression. The expression is in the Scanner, and is
     * not empty. The operations +, -, * and / are implemented. The numbers in
     * the expression may include decimal points, and all operations are done
     * using floating-point arithmetic.
     * <p>
     * The method prints the intermediate calculations as it goes along, and
     * returns the final value of the expression.
     * <p>
     * The method throws exceptions as appropriate.
     *
     * @param in the Scanner containing the postfix expression
     * @return the value of that postfix expression
     * @throws (exceptions as appropriate)
     */
    private static double process(Scanner in) {
        return 0.0;
    }

}
