Access over 20 million homework & study documents

search

IT210 - Week 6 Algorithm Verification Appedix J

Type

Homework

Rating

Showing Page:
1/2
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 crash instantly 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,
100 is a valid score. 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"
else if (X < 70)
output "your grade is" X
output "you did OK"
else if (X < 85)

Sign up to view the full document!

lock_open Sign Up
output "your grade is" X
output "you did well"
else if (X < 100)
output "your grade is" X
output "you did great"
else
output "Invalid Score"
end if
o How many levels of nesting are there in this design?
There is no nesting in the problem. Nesting is defined as a control structure
within a control structure. This is just one multiple selection statement.
o Give a set of values that will test the normal operation of this program
segment. Defend your choices.
1. 0 and 49 will test the boundary conditions of the first condition.
2. 50 and 69 will test the boundary conditions of the second condition.
3. 70 and 84 will test the boundary conditions of the third condition.
4. 85 and 100 will test the boundary conditions of the third condition (which
will reveal a mistake in that 100 is a valid score).
o Give a set of test values that will cause each of the branches to be executed.
1. 8 will test the first selection.
2. 58 will test the second selection.
3. 83 will test the second selection.
4. 95 will test the fourth selection.
o Give a set of test values that test the abnormal operation of this program
segment.
1. -32 will test the invalid input below 0.
2. 220 will test the invalid input above 100.

Sign up to view the full document!

lock_open Sign Up
User generated content is uploaded by users for the purposes of learning and should be used following Studypool's honor code & terms of service.

Anonymous
This is great! Exactly what I wanted.

Studypool
4.7
Trustpilot
4.5
Sitejabber
4.4