title: Solving Binary Tree
body: <p>Can anyone explain how I Solve a expression Tree when I'm given x as a parameter?</p>
  
  <p>For example, I have the equation ((2*x)) + 4and let's say in the parameter, x = 3.
  This would give us 10 and the method would return this.</p>
  
  <p>The way I thought about doing this was to do it recursively but I can't really do it because the parameter has to be the double x.</p>
  
  <p>Any thoughts?</p>
  
  <p>Here's the code I have so far.</p>
  
  <pre><code>  public double evaluate(double x) throws ExpressionTreeNodeException {
      ExpressionTreeNode n = new ExpressionTreeNode();
      n.setValue(getValue());
      n.setType(getType());
      if ( n.getRightChild() == null &amp;&amp; n.getLeftChild() == null){
          double RootLeaf = Double.parseDouble(n.getValue());
          return RootLeaf;
      } else {
          double operand1 = 
          return ()
      }
  }
  </code></pre>