title: How can I make this code so that only the final answer will print?
body: <p>I need this to only display the final answer and not the answer from the first part of the code. This is because it currently displays two answers; one from the first part and one from the last part and all I need is the answer from the last part to display </p>
  
  <pre><code>public class Arbitrary extends ArithmeticExpression {
   Arbitrary(double value1, double value2, double value3, char operator1, char operator2){
  this.value1 = value1;
  this.value2 = value2;
  this.value3 = value3;
  this.operator1 = operator1;
  this.operator2 = operator2;
  }
  
  
  public double evaluate(){
      System.out.println("Arbitrary Answer Is");
  
      if (operator1 == '+'){            // this if statement covers all the signs that may come up,if the first sign is a +, then the program will add the two numbers but if it isn't. The program will continue to go to else until it finds the correct sign or states the rror message.//
          Addition add = new Addition(value1,value2);
          result1 = add.evaluate();
      }
      else if (operator1 == '-'){
          Subtraction sub = new Subtraction(value1,value2);
          result1 = sub.evaluate();
      }
      else if (operator1 == '*'){
          Multiplication mult = new Multiplication(value1,value2);
          result1 = mult.evaluate();
      }
      else if (operator1 == '/'){
          Division div = new Division(value1,value2);
          result1 = div.evaluate();
      }
      else{
          System.out.println("Invalid Sum!");
      }
  
  
      if (operator2 == '+')
  
               {
          Addition plus = new Addition(result1,value3);
          result2 = plus.evaluate();
              }
  
  
      else if (operator2 == '-')
      {
          Subtraction take = new Subtraction(result1,value3);
          result2 = take.evaluate();
      }
      else if (operator2 == '*'){
          Multiplication times = new Multiplication(result1,value3);
          result2 = times.evaluate();
      }
      else if (operator2 == '/'){
          Division share = new Division(result1,value3);
          result2 = share.evaluate();
      }
      else{
          System.out.println("Incorrect expression!");
      }
  
      return result2;
  }
  
  public double display() {
        System.out.println("Abitrary Question Is");
      System.out.println("("+value1 + "+" + value2+")" + " * "+ "("+value3+")");
      return result2;
  
  }
  
  }
  </code></pre>
  
  <p>this part is in my main:</p>
  
  <pre><code>Arbitrary a1 = new Arbitrary(6, 9, 2, '+', '*');
             a1.display();
             a1.evaluate();
             System.out.println();
  </code></pre>
  
  <p>this is the output i get:
  Abitrary Question Is
  (6.0+9.0) * (2.0)
  Addition Answer Is
  15.0
  Multiplication Answer Is
  30.0</p>
  
  <p>and what i am supposed to get is:
  Abitrary Question Is
  (6.0+9.0) * (2.0)
  Arbitrary Answer is
  30.0</p>
  
  <p>addition.java</p>
  
  <pre><code>   class Addition extends ArithmeticExpression{
  Addition(double value1, double value2){
     result = value1 + value2;
     this.value1 = value1;
      this.value2 = value2;
  }
  
  
  public double display() {
      System.out.println("Addition Question Is ");
      System.out.println(value1 + " + "+ value2);
      return result;
  
  }
  public double evaluate(){
      System.out.println("Addition Answer Is");
      System.out.println(result);
  return result;
  }
  }
  </code></pre>
  
  <p>multiplication.java</p>
  
  <pre><code>   class Multiplication extends ArithmeticExpression{
  Multiplication(double value1, double value2){
      result = value1 * value2;
      this.value1 = value1;
      this.value2 = value2;
  }
  
  
  
  public double display() {
        System.out.println("Multiplication Question Is");
      System.out.println(value1 + " * "+ value2);
      return result;
  
  }
  public double evaluate(){
        System.out.println("Multiplication Answer Is");
      System.out.println(result);
      return result;
  }
  
  
  }
  </code></pre>