It/210 Wk6 Checkpoint Algorithm Verification

Submitted by: Submitted by

Views: 1892

Words: 526

Pages: 3

Category: Other Topics

Date Submitted: 02/25/2012 10:22 PM

Report This Essay

What will be printed if the output is 0:

Output is

You fail.

The block if (0 <= X and X < 49) output "you fail" is executed.

What will be printed if the output is 100:

Output is

How did you do?

It will not meet any of the requirements for the other code. This number is outside all 4 Ranges but is a numerical so it will just go to the bottom

What will be printed if the output is 51:

Output is

Your grade is 51.

You did okay.

The section else if (50 <= X and X < 70) output "your grade is" X output "you did OK" is executed.

What will be printed if the user enters “Wingding”?

There is not a selection in the code for handling Winding. Only numbers will generate a result it will give an error. 

Is this design robust? If so, explain why. If not, explain what you can do to make it robust.

The design is not robust as there are no statements for error handling and handling exceptions. To make this code more robust we would need to add error handling statements.

Alpha Numeric should output invalid entry.

Negatives should also output invalid entry

Any numeric entry that is not 0-100 should output invalid entry.

Any entry that doesn’t include the above options like extended ascii codes should also output invalid entry

All of these should then output entry has to be between 0-100 and then ask them to enter input.

Tweaking the code a bit to fix the ranges

if (0 <= X and X < 49) should be if (0 <= X and X <= 49)

else if (85 <= X and X < 100) should be else if (85 <= X and X <= 100)

How many levels of nesting are there in this design?

This code contains 1 level of nesting.

Provide a set of values that will test the normal operation of this program segment. Defend your choices.

Any user input value between 0 100 will test the normal operation of this program because the algorithm only handles this range.

Provide a set of test values that will cause each of the branches to be executed.

A set...