public static void main(String[] args) {
    BufferedReader br;
    String fromUnit = null;
    String toUnit = null;
    double value = 0;

    //  prompt the user to enter unit to convert from
    System.out.print("Convert from: ");
    //  open up standard input
    br = new BufferedReader(new InputStreamReader(System.in));
    try {
      fromUnit = br.readLine();
    } catch (IOException ioe) {
      System.exit(1);
    }
    // prompt user to enter unit to convert to
    System.out.print("Convert to: ");
    br = new BufferedReader(new InputStreamReader(System.in));
    try {
      toUnit = br.readLine();
    } catch (IOException ioe) {
      System.exit(1);
    }

    // create new UnitConvert objects
    UnitConverter from = new UnitConverter(fromUnit);
    UnitConverter to = new UnitConverter(toUnit);

    // prompt user to enter initial value to convert
    System.out.print("Value: ");
    br = new BufferedReader(new InputStreamReader(System.in));
    try {
      value = Double.parseDouble(br.readLine());
    } catch (IOException ioe) {
      System.exit(1);
    }

    double metric = from.toMetric(value);
    double converted = to.fromMetric(metric);

    if (converted < 0) {
      System.out.println("ERROR: Bad Input");
    } else {
      System.out.println(value + " " + fromUnit + " = " + converted + " " + toUnit);
    }
  }