Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Application Development And Design

Authors: Michael V. Mannino

1st Edition

0072463678, 978-0072463675

Students also viewed these Databases questions

Question

(7) explain Risk Analysis and the Risk in investing in Walmart

Answered: 1 week ago

Question

b. Why were these values considered important?

Answered: 1 week ago