public double evaluate(){
  if (!variables.isEmpty()) {
    throw new RuntimeException("variables " + variables + " are not set");
  }
  Expression exp2=new Expression(exp);
  return exp2.evaluate();
}

public double evaluate ( ) { if ( ! variables . isEmpty ( ) ) { throw new RuntimeException ( "variables " + variables + " are not set" ) ; } Expression exp2 = new Expression ( exp ) ; return exp2 . evaluate ( ) ; }
evaluates the result of the expression
