Question: Please use Functions in RSL. No code. Theoretical analysis only. (a) Define a function called TriangleSurface in RSL that takes a right-angled triangle as a

 Please use Functions in RSL. No code. Theoretical analysis only. (a)

Please use Functions in RSL. No code. Theoretical analysis only.

(a) Define a function called TriangleSurface in RSL that takes a right-angled triangle as a single argument and calculates and returns a positive integer number that is the area of the triangle. (b) Explain in plain English how this function works. A right-angled triangle is a triangle with one 90 degrees angle. The area of a right-angled triangle is equal to AB/2 where A and B are sides of the triangle that form the 90 degrees angle. Hint 1: Define a type that can model a triangle. Hint 2: Conditions on the output of the function should be encoded in its postcondition. Hint 2: Conditions on the input of the function should be encoded in its precondition. To check if a triangle is right angled you can find a side C of the triangle such that C2 = A2 + B2

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!