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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started