Algorithm Verification

Algorithm Verification - Algorithm Verification Consider...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
Algorithm Verification Consider the following selection statement where X is an integer test score between 0 and 100. input X if (0 <= X and X < 49) output "you fail" else if (50 <= X and X < 70) output "your grade is" X output "you did OK" else if (70 <= X and X < 85) output "your grade is" X output "you did well" else if (85 <= X and X < 100) output "your grade is" X output "you did great" endif output "how did you do?" What will be printed if the input is 0? You fail How did you do? What will be printed if the input is 100? How did you do? What will be printed if the input is 51? Your grade is 51 You did OK How did you do? What will be printed if the user enters “wingding”? How did you do?, because “wingding” does not meet any of the “if” requirements and is not a value between 0 and 100.
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Is this design robust? No, it does not specify what the output would be for a non-numeric value and there is no condition for a score of 100 or 49, which is a valid score. Therefore, the following should be added and or changed.
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

Page1 / 3

Algorithm Verification - Algorithm Verification Consider...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online