Due: Wednesday 10/02 10:00am
Submission name: work11.png (or other image file type)
For this assignment, you will be asked to make flowcharts. You can draw these by hand or using a computer drawing program. Instead of submitting a Racket programming file, upload an image containing both of your flowcharts. If you cannot fit all flow charts on one image, then name them work11-0
and work11-1
, and so on.
For each flowchart, draw a general function flowchart followed by a test case chart. If the function has different possible results, make test case charts for each possible path.
- Square area
- Takes an input for the side length of a square.
- Outputs the area of that square.
- Circle area
- Takes an input for the radius of a circle
- Outputs the area of that circle.
- Shape Area
- Takes in 2 inputs.
- If the first input is even, output the area of a square using the second input as the side length.
- If the first input is odd, output the area of a circle using the second input as the radius.
- Closer Number
- Takes 3 numbers as inputs.
- Outputs whichever of the first 2 inputs is closer to the third input.
- By closeness we are referring to the distance between 2 numbers on a number line.
- The distance between 16 and 10 is 6
- The distance between 7 and 10 is 3
- 7 is closer to 10 than 16
Example Function Flowchart:
flowchart LR;
id0([getTensDigit]) -- n --> id1[quotient\nn 10];
id1 -- result0 --> id2[remainder\nresult0 10];
id2 --> id3([result1]);
Example Test Case Flowchart:
flowchart LR;
id0([getTensDigit]) -- 8765 --> id1[quotient\n8765 10];
id1 -- 876 --> id2[remainder\n876 10];
id2 --> id3([6]);