PPT Slide
Debugging Tools/Strategies: The Assert Statement
CS1502 has created a general purpose utility class to assist you in programming. (See the class web page, and labs.) One useful method is ASSERT(), which can be used to validate assumptions and conditions.
Precondition: statement that must be true
before the method can begin execution.
Postcondition: statement that must be true
after the method has executed.
util.ASSERT(iDenominator!=0,
“Can’t divide by zero!”);