Question: To enhance the correctness of function logic, professional programmers often place precondition to check the validity of all the parameter values given to a function
To enhance the correctness of function logic, professional programmers often place "precondition" to check the validity of all the parameter values given to a function and also place "postcondition" to verify a computed result to be proper or not before returning to a caller.
Suppose that you need to develop a function triangleArea(s1, s2, s3) will return the area of the triangle formed by the three side s1, s2, and s3. What kind of precondition and postcondition can you add to this function? You do not need to write a program but indicate what conditions to add.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
