public bool execute() { //Postcondition: Returns the boolean result of [arith1] [op] [arith2] (i.e. 1 < 2) switch (op) { case BoolOperator.EQL_OP: return(arith1.evaluate() == arith2.evaluate()); case BoolOperator.GREQ_OP: return(arith1.evaluate() >= arith2.evaluate()); case BoolOperator.GRTN_OP: return(arith1.evaluate() > arith2.evaluate()); case BoolOperator.LSQU_OP: return(arith1.evaluate() <= arith2.evaluate()); case BoolOperator.LSTN_OP: return(arith1.evaluate() < arith2.evaluate()); case BoolOperator.NTEQL_OP: return(arith1.evaluate() != arith2.evaluate()); default: throw new Exception("Invalid BoolOperator used in BoolExpression evaluation"); } }
public void execute() { //Postcondition: Prints the ArithExpression's value to the console Console.WriteLine($"{arith.evaluate()}"); }
public void execute() { //Postcondition: Makes the Id's current value equal to the ArithExpression's value Memory.store(id.Character, arith.evaluate()); }