Plan and test a smart idea
Answers are for parents and teachers.
1
Write the data type (integer or string) of each value: 9, "9", "light", 2024, "Hi!".
| Value | Data type |
|---|---|
| 9 | ? |
| "9" | ? |
| "light" | ? |
| 2024 | ? |
| "Hi!" | ? |
9 is an integer. "9" is a string. "light" is a string. 2024 is an integer. "Hi!" is a string.
2
Break down this problem into the five questions of a plan: a seed-tray sign shows a tick if the temperature is warm enough for seeds (15 degrees or more) and a cross if not.
Goal: show whether the tray is warm enough. Sensor: temperature sensor. Comparison and threshold: temperature >= 15. Output if yes: a tick. Output if no: a cross.
3
Draw the flowchart for the plan above and use a variable called tray_temp.
Start; process box “tray_temp = temperature reading”; diamond “tray_temp >= 15?”; yes: show a tick; no: show a cross; both lead to End.
4
Write a test plan with five tests for your flowchart. Work out the expected outcomes first.
Model answer: 0 – cross; 14 – cross; 15 – tick; 16 – tick; 40 – tick. The test value 15 checks the boundary.
5
The program for the seed-tray sign uses tray_temp > 15. Which of your five tests fails, and what is the correction?
Test 3 (15) fails: the expected outcome is a tick but the program shows a cross. The correction is >= 15.