Answer:
Explanation to the approach and code given below
Step-by-step explanation:
I am considering that you need only a defined subclass and not the working program.
So given statement is,
The class ICalculator has one additional method ,sign, that receives no arguments , and doesn't modify currentValue. Instead, it simply returns 1, 0 or -1 depending on the whether currentValue is positive, zero, or negative respectively.
Here is the code:
public class ICalculator1 extends ICalculator {
public int sign() {
if (currentValue != 0) {
return currentValue * -1;}
else {
return 0;
}
}
}
or you can try this alternative soluton.
public int sign() {
int value = add(0); // add 0 and return currentValue
if (value > 0) return 1;
else if (value < 0) return -1;
else return 0;
}