Computer Science Homework Solutions
Problem
#159678

Algorithm Verification

Answer the following questions about the information in Appendix J:
o What will be printed if the input is 0?
o What will be printed if the input is 100?
o What will be printed if the input is 51?
o What will be printed if the user enters “Wingding”?
o Is this design robust? If so, explain why. If not, explain what you can do to make it
robust.
o How many levels of nesting are there in this design?
o Give a set of values that will test the normal operation of this program segment.
Defend your choices.
o Give a set of test values that will cause each of the branches to be executed.
o Give a set of test values that test the abnormal operation of this program segment.

Attached file(s):
Attachments
it210 appendix j.doc  View File

Attachment Content Summary (Note: view attachment at the above link before purchasing. Actual attachment content may vary slightly from that shown below.)

it210 appendix j.doc
Appendix J

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?"

IT 210
Solution
What is this?
By OTA - Overall OTA Rating
Purchase Cost Now
$2.19 CAD (was ~$19.95)
Included in Download
  • Plain text response
$2.19 Instant Download
Add to Cart
Why you can trust BrainMass.com
  • Your Information is Secure
  • Best Online Academic Help Service
  • Students find real academic Success
Related Solutions
  • Data Structures C++ - You should post the "best possible" responses to the question. Remember that the main purpose of algorithm questions is to come up with the best possible algorithms through discussion. It is ok to wri ...
  • Ambiguity in a proposed algorithm - Explain the distinction between an ambiguity in a proposed algorithm and an ambiguity in the representation of an algorithm.
  • Automata and Computability - Describe the error in the following fallacious “proof” that P  NP. Consider an algorithm for SAT: “On input , try all possible assignments to the variables. Accept if any satisfy  ...
  • Algorithms - Analyzing Algorithm Performance - Design an algorithm that tests whether or not two input lists of size n have at least one element in common. Give formulas for B(n) and W(n) for your algorithm.
  • Write a Turing machine algorithm to perform a unary decrement. - Write a Turing machine algorithm to perform a unary decrement. Assume that the input number may be 0, in which case a single 0 should be output on the tape to signify that the operation results in a n ...
Browse