Read this chapter, which reviews how computers make decisions using if statements. As you read this tutorial, you will understand that sometimes it is important to evaluate the value of an expression and perform a task if the value comes out to be true and another task if it is false. In particular, try the simulated program under the heading "Simulated Program" to see how a different response is presented to the user based on if a number is positive or negative.
Pay special attention to the "More Than One Statement per Branch" header to learn how the 'else' statement is used when there is more than one choice.
17. Flowchart
Answer:
You could first divide the group into:
- children
- adults
And then divide the adults into:
- male adults
- female adults
Flowchart
We wish to perform two splits to divide integers into negative, zero, and positive. First zero and positives are split from the negatives, and then that group is further split.
Question 17: