GRADE 10 IT ALGORITHMS FLOWCHARTS TRACETABLES QUESTION ONE
GRADE 10 IT ALGORITHMS FLOWCHARTS TRACETABLES
QUESTION ONE • Input a number until a number in the range of 1 to 10 is entered. • Display the cube of the number if it falls into the range and the square of the number if it falls outside the range. • Count the number of inputs. Display this number only at the end. • Sample data: 12; 56; 13; 5 • Draw a flowchart. • Draw a trace table for the sample data.
start count = 0 NB: Your diagram layout may be different to this but your logic must be the same. Input value count = count + 1 value >= 1 AND value <= 10 true value = value x value count false value = value x value Sample data: 12; 56; 13; 5 stop
Start like this …. step count 1 0 2 3 value 12 1 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 >= 1 AND <= 10 FALSE 144
step count 1 0 2 3 value 12 1 4 FALSE 5 144 6 56 7 2 8 FALSE 9 3136 10 13 11 3 12 FALSE 13 169 14 5 15 >= 1 AND <= 10 4 16 TRUE 17 125 18 4
QUESTION TWO • Special for the week: Discount offered is R 100 -00 off your final amount. • To qualify for the discount you have to spend more than R 1000 -00 and you have to buy more than 3 items • Add the value of the products bought until the value input from the keyboard is zero**. • Display the total amount. • If discount applies, display the discounted final amount. • Sample data: R 150 -00, R 275 -00, R 450 -00, and R 120 -00 and finally R 0. 00**
start discount = 100 Your layout may be different but the logic must be the same. stop total – discount Sample data: 150; 275; 450; 120; 0 count = 0 total = 0. 00 total Input amount total false amount > 0. 00 true count = count + 1 total > 1000 AND count > 3 true total = total + amount
Start like this. . . step 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 discount 100 count 0 amount > 0 total 0 150 TRUE 1 150 amount > 1000 AND count > 3
step 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 discount 100 count 0 amount > 0 total 0 amount > 1000 AND count > 3 150 TRUE 1 150 275 TRUE 2 425 450 TRUE 3 875 120 TRUE 4 995 0 FALSE 995
- Slides: 9