Question: Consider the following program which classifies triangles as one of a scalene, isosceles, right or equilateral triangle and computes its area. Suppose it is initially

Consider the following program which classifies triangles as one of a scalene, isosceles, right or equilateral triangle and computes its area. Suppose it is initially tested using the first 4 test cases provided in the following table. T5 is added to the test case and program incorrectly computes the area. Debugging reveals an error in Statement 11. It uses expression a*2 instead of a*a. Suppose the fault is corrected and new program must be rerun to verify that it produces the correct output. Recommend a regression test case to reevaluate the program. Program Code: S1: read (a, b, c); S2: class = scalene; S3: if a=b or b=a S4: class=isosceles; S5: if a*a=b*b + c*c S6: class=right; S7: if a=b=c S8 class= equilateral S9: case class of S10: right: area=b*c/2 S11: equilateral: area= a*2*sqrt(3)/4; S12: otherwise: s= (a+b+c)/2; S13: area= sqrt(s*(s-a)*(s-b)*(s-c)); end; S14: write (class, area) Test Cases:

Test Case Input Output
a b c Class Area
T1 2 2 2 Equi 1.73
T2 4 4 3 Isosceles 5.56
T3 5 4 3 Right 6.00
T4 6 5 4 Scalene 9.92
T5 3 3 3 Equi 2.60 (error)

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!