import java.io.*;
import java.util.*;

/**
 * A small example of polymorphism as it arises through the
 * use of interfaces
 *
 * @author  Prof. David Bernstein, James Madison University
 * @version 1.0
 */
public class Driver
{
    /**
     * The entry point
     *
     * @param args   The command-line arguments
     */
    public static void main(String[] args) throws IOException
    {
        BufferedReader         in;
        FractionAddingMachine  fam;
        String                 line, result;
        WeightAddingMachine    wam;

        in = new BufferedReader(new InputStreamReader(System.in));

        // A Weight example
        System.out.println("Enter an expression involving Weight objects: ");
        line   = in.readLine();
        wam    = new WeightAddingMachine();
        result = wam.evaluate(line);
        System.out.println(result);

        // A Fraction example
        System.out.println("Enter an expression involving Fraction objects: ");
        line   = in.readLine();
        fam    = new FractionAddingMachine();
        result = fam.evaluate(line);
        System.out.println(result);
    }
    
}
