Supply teacher deck · IT · Year 7

Tracing a Tuck Shop Till Algorithm

Slide 1 of 7
04:00

Slide 1 of 7 · Settling starter · IT · Year 7

4 minutes

Siop Fach: you are the till tester

Siop Fach is the tuck shop run by Year 10 pupils at Ysgol Bro Ceri. Last year the volunteers added up orders in their heads and often gave the wrong change. The IT department has written a till program. Before it goes live, you test it.

While the register is called: write your name, class and date on your worksheet, then read sections 1 and 2 of the stimulus sheet, the price list.

Starter question: The till works in pence. How is a cheese roll stored in the till, and how much is toast and a bottle of water together?

DCF: Data and computational thinking → Problem-solving and modelling No computers, no calculators · pen and paper only

Slide 2 of 7 · Today’s brief and key words · IT · Year 7

3 minutes

Your brief: follow the flowchart exactly as a computer would

You will follow the till flowchart for 3 real orders, record every value in a trace table, give change in the fewest coins, design 5 tests, find 2 bugs in Version 2, and plan a week of snacks on £10. Deal of the day: buy 3 or more items and get 25p off.

Algorithm

A set of steps followed in order. The flowchart is the till’s algorithm; each shape has a number from 1 to 13.

Trace table

A table where you write the new value of items, total, paid and change every time one of them changes.

Decision

A diamond: a Yes or No question such as “Is items 3 or more?”. Rectangles are processes, slanted boxes are inputs and outputs.

Bug

A mistake in the program. You find one by comparing what the till should output with what it does output.

LNF: Numeracy → Understanding the number system helps us to represent and compare relationships between numbers and quantities → Financial literacy Everything in pence: £1.20 is 120

Slide 3 of 7 · Step 2: trace three orders · IT · Year 7

14 minutes

Step 2: trace Orders A, B and C, one box at a time

Every time a value changes, write the new value on the next row. Work in pence. Do not jump ahead. Order A (Rhys): toast, bottle of water, pays with a £2 coin. The first rows are done for you:

Box items total paid change Output
2 0 0
4 1 60
4 2 130

Order B (Ffion): flapjack, fruit juice, fruit pot, pays with a £5 note. Order C (Osian): cheese roll, fruit juice, hands over £2; when the till asks again, £2.10.

Step 2 on your worksheet · 15 minutes Box 7 only runs for 3 or more items

Slide 4 of 7 · Steps 3 and 4: fewest coins, then plan the tests · IT · Year 7

16 minutes

Step 3: the fewest coins. Step 4: plan the tests

Step 3 (7 min): the till starts with the biggest coin that fits, gives as many as it can, then moves down. Coins: £2, £1, 50p, 20p, 10p, 5p, 2p, 1p. Then answer: why start with the biggest coin?

Step 4 (10 min): good testers choose data at the edges of a rule: exactly 3 items, or paying the exact amount. Work out what a correct till should output. Show your working.

Test What it checks Order and money paid Expected output
1 2 items: no discount Toast, water. Pays 200p. 60 + 70 = 130. 200 take away 130 = 70. Change 70p (50p, 20p).
Steps 3 and 4 on your worksheet · 17 minutes Work out the expected answer from the rules, not from the till

Slide 5 of 7 · Steps 5 and 6: find the bugs, then a week on a budget · IT · Year 7

14 minutes

Step 5: find the bugs in Version 2. Step 6: a week on £10

Step 5 (8 min): the programmer ran your 5 tests on Version 2. Compare each output with your expected output and write Pass or Fail. For each fail, say which box is wrong, what it probably says and what it should say. Then (b): why did Test 5 pass even though the discount box has a bug?

Test Version 2 output Pass or fail?
1 Change 70p (50p, 20p) Pass: matches the expected output.
2 “Not enough money” Fail: we expected change 15p.

Step 6 (10 min): work in pence, then give each answer in pounds and pence. (a) cheapest 3-item order, (b) Gwen’s week on £10, (c) Ffion’s flapjack and juice plan, (d) your own week: at least 2 items every day.

Steps 5 and 6 on your worksheet · 18 minutes Bugs hide at the edge of a rule

Slide 6 of 7 · Self and partner check · IT · Year 7

2 minutes

Success criteria: tick, then correct one thing

Swap worksheets with a partner. Tick each success criterion their work meets, then they correct 1 thing.

  • I can name the input, process, decision and output boxes in a flowchart.
  • I can trace an algorithm one step at a time and record every change in a trace table.
  • I can choose test data at the edges of a rule and work out the expected output.
  • I can compare expected and actual outputs to find and fix a bug.
  • I can work in pence and pounds to calculate totals, discounts, change and a weekly budget.
2 minutes · partner check Finished early? Try the 10% off rule at the bottom of your sheet

Slide 7 of 7 · Plenary review · IT · Year 7

2 minutes

Quick-check answers before handing in

Check your main answers before your worksheets are collected.

Question Correct answer
Order B: Ffion pays £5 for a flapjack, fruit juice and fruit pot. What is the total and the change? Total £2.30 (255 take away 25), change £2.70: £2, 50p, 20p.
Which 2 boxes have bugs in Version 2? Box 6 (should say “Is items 3 or more?”) and box 9 (should say “Is paid less than total?”).
Gwen buys the cheapest 3-item order every day for 5 days. What does the week cost from £10? 185p × 5 = £9.25, with 75p left.
Check your name and class are on your worksheet Leave stimulus sheets neat on the desk