Answered step by step
Verified Expert Solution
Link Copied!

Question

00
1 Approved Answer

Rewrite the program segment 14-20 such that the compound conditions are replaced by nested if-then-else statements. Compare the cyclomatic complexity of your program with that

Rewrite the program segment 14-20 such that the compound conditions are replaced by nested if-then-else statements. Compare the cyclomatic complexity of your program with that of the existing version.

14. If (a = b) AND (b = c)

15. Then Output ("Equilateral")

16. Else If (a != b) AND (a != c) AND (b != c)

17. Then Output ("Scalene")

18. Else Output ("Isosceles")

19. EndIf

20. EndIf

Also, look at the original program segments 14-20. What happens with a test case (e.g., a = 3, b = 4, c = 3) in which a = c? The condition in line 14 uses the transitivity of equality to eliminate the a = c condition. Is this a problem?

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered 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

Students also viewed these Databases questions