public static Term scanTerm (Scanner s) {
        String coef_patt = "\\-?\\d+(\\.\\d+)?";
        if (s.hasNext (coef_patt)) {
            String coef = s.next(coef_patt);
            int exp  = s.nextInt();
            return new Term (Double.parseDouble(coef), exp);
        } else {
            return null;
        }
    }