{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

Algorithm Verification

# Algorithm Verification - Algorithm Verification o What will...

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

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"

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

View Full Document
else if (X < 70) output "your grade is" X output "you did OK"
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern