Flowcharting and Trace Tables
Flowcharting and Trace Tables
5. Do a trace for each of the following. Assume I starts as 1 and sum starts as 0.
6. a) Draw a flowchart to find the sum of all the cubes from one up to but not including 10.
b) Show by flowchart how you would change your program to include 10.
7. Draw a flowchart to calculate a salesman's gross monthly pay. For sales up to $1000 he is paid $100
in salary. For his sales from $1000 up to and including $2500 he is paid 15%. For any sales greater
than $2500 he obtains 18%. The input is the salesman's sales for the month.
8. Draw a flowchart to determine whether a number is a multiple of five. Test this with trace tables
using the values 15, 17 and -20.
9. Draw a flowchart to find the larger of two numbers. Call them X and Y. It is not known which is the
larger when you start. Test your flowchart (by using a trace table) with 8 and 3. Also test with 2 and
9. Finally check it with 7 and 7.
10. Draw a flowchart to find the largest of three numbers. Call them X, Y and Z. They could enter in any
order so all possibilities must be considered. None of them is equal. Test by using
X
9
9
4
2
4
2
Y
4
2
9
9
2
4
Z
2
4
2
4
9
9