Question: Theoretical Analysis Only. No Code (a) Define a function called TriangleSurface in RSL that takes a right-angled triangle as a single argument and calculates and

Theoretical Analysis Only. No Code
(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
Get step-by-step solutions from verified subject matter experts
