☰ خطة العام · تكنولوجيا المعلومات والاتصالات (بالإنجليزية)

Code, mazes and flowcharts

الأسبوع 27 · المحور الرابع، الدرس ٦ «مبادئ البرمجة» · 3 دروس
3

Flowcharts with yes and no

ICT P4 Term 2, Theme 4: pp. 66–69
GoalRead and draw a flowchart with yes and no questions, and see programming as a way to solve problems.
New words
flowchart · a picture of an algorithm with shapes and arrowsdecision · a question with the answer yes or nostart · where the chart beginsend · where the chart finishes
Explanation

A flowchart is a picture of an algorithm. It shows a problem as simple logical steps joined by arrows. Ovals mark the start and the end, rectangles hold actions, and diamonds hold yes/no questions called decisions. Start at the beginning and follow the arrow, answer each question honestly, and take the “yes” path or the “no” path. Programming is also a way to solve problems: you break the problem into steps, test your steps, and fix the bugs. People who write code need imagination, because they invent new things, and patience, because trying and fixing is part of the job.

StartIs it raining?yesnoTake an umbrellaLeave the umbrellaEnd
Worked examples
StartIs the soil dry?yesnoWater the plantWait until tomorrowEnd
A chart for a plant: if the soil is dry we water the plant, otherwise we wait until tomorrow.
StartIs my bag packed?yesnoGo to the doorPack my bagIs it raining?yesnoTake an umbrellaWear a hatEnd
Follow this chart: the bag is packed (yes) and it is not raining (no). The path: go to the door, then wear a hat.
draw the charttest itfix it
Nour drew a chart for feeding the cat and tested it with her brother. They found a missing question: “Is the bowl empty?” She added it. This is trying and fixing.
Class activity

Draw a flowchart. Choose a simple decision, such as “Do I need a jacket?” or “Is it time to sleep?”. On paper, draw an oval for the start, a diamond for the question with two arrows (yes and no), rectangles for the actions, and an oval for the end. Test it with a partner: ask them to answer once with yes and once with no.

Practice
1
Which shape holds a yes/no question?
2
Follow the chart: the bottle is empty. What action is on your path?
StartIs the bottle empty?yesnoFill the bottlePut it in the bagEnd
3
Which shapes show the start and end, and which show actions?
4
How is programming like solving problems?