1 / 1100%
@Override
public Operand evaluate(Operand pOperand) {
return new Operand(-pOperand.getValue());
}
@Override
public int precedence() {
return 4;
}
@Override
public int stackPrecedence() {
return 4;
}
}
Powered by TCPDF (www.tcpdf.org)
/**
* Represents the negation operator which is a specific type of unary operator.
*/
public class NegOperator extends UnaryOperator{
//****************************************************************************
// CLASS: NegOperator.java
//
// COURSE AND PROJECT INFO
// CSE205 Object Oriented Programing and Data Structures
//****************************************************************************
Students also viewed