Algorithm Verification

Algorithm - Algorithm Verification o What will be printed if the input is 0 You fail How did you do o What will be printed if the input is 100 How

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

View Full Document Right Arrow Icon
Algorithm Verification o What will be printed if the input is 0? You fail. How did you do? o What will be printed if the input is 100? How did you do? o What will be printed is the input is 51? Your grade is 51. You did OK. How did you do? o What will be printed if the user enters “Wingding”? The program will abnormally terminate because it is expecting an integer value, and a string value will cause the program to crash. o Is this design robust? If so, explain why. If not, explain what you can do to make it robust. No, there is no default condition for Scores >= 100, or scores < 0. In addition, 49 and 100 are valid scores. The following should, therefore, be added: 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" else output “Invalid Score” end if Alternative: if (X >= 0 and X <= 49) output "you fail"
Background image of page 1

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

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 08/12/2011 for the course IT 215 taught by Professor Danielreddy during the Spring '11 term at University of Phoenix.

Page1 / 2

Algorithm - Algorithm Verification o What will be printed if the input is 0 You fail How did you do o What will be printed if the input is 100 How

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

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