@Override
    public String toString() {
        String aStr = a != 0 ? a + "x" : "";
        String bStr = b != 0 ? (b < 0 ? (Double)(b * -1) : b).toString() : "";

        String eqStr;
        eqStr = !aStr.isEmpty() && !bStr.isEmpty() ? aStr + (b > 0 ? " + " : " - ") + bStr : aStr + bStr;
        eqStr = eqStr.equals("") ? "0" : eqStr;
        return "f(x) = " + eqStr;
    }