title: int reverse sign negate( ) java
body: <p><strong>Requirements</strong></p>
  <p>Assume the availability of an existing class, ICalculator, that models an integer arithmetic calculator and contains:</p>
  <ul>
  <li><p>an instance variable currentValue that stores the current int value
  of the calculator and can be accessed and modified by any subclass.</p>
  </li>
  <li><p>methods add, sub, mul, and div</p>
  <p>Each method in ICalculator receives an int argument and applies its operation to currentValue and returns the new value of currentValue. So, if currentValue has the value 8 and sub(6) is invoked then currentValue ends up with the value 2, and 2 is returned.</p>
  </li>
  </ul>
  <p>So, you are to write the definition of a subclass, ICalculator2, based on ICalculator. The class ICalculator2 has one additional method, negate, that receives no arguments. The effect of negate is to reverse the sign of currentValue. For example, if currentValue is zero, there is no change, if it is -22 then it becomes 22, if it is 100 it becomes -100. Furthermore negate returns the new value of currentValue.</p>
  <p><strong>Source Code</strong></p>
  <pre><code>public class ICalculator2 extends ICalculator {
  public int negate() { 
  int val = add(0);      
  if (val == -22) return val * -1;   
  else if (val == 100) return val * -1;   
  else return 0;}}
  </code></pre>
  <p><strong>Remarks:</strong></p>
  <ul>
  <li>Your code had an error during execution</li>
  </ul>
  <p><strong>More Hints:</strong></p>
  <ul>
  <li><p>You might want to use a number other than 100</p>
  </li>
  <li><p>You might want to use a number other than 22</p>
  </li>
  <li><p>Are you sure you want to use: val</p>
  </li>
  </ul>
  <p><strong>Hints:</strong></p>
  <ul>
  <li>You might want to use: &lt;</li>
  <li>Are you sure you want to use: =</li>
  </ul>