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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!