2. WHAT’S A FLOW DIAGRAM?
A flow diagram is a graphic
representation of a
sequence.
The flow diagram of a program
is the graphic representation
of the sequence of actions
that the computer performs
when we run the program.
This is a very complex example of a flow diagram
3. EXERCISES
In the next slides, you’ll read a different proposals
of sequences of programs.
You will work cooperatively to work out the flow
diagrams of those sequences. You have to use
the symbols we’ve studied in class
Then, you’ll see the solutions and the teacher will
explain.
This is also useful when you study at home.
4. PROGRAM 1
When the program starts, the computer asks the
user for two numbers (a and b).
The user enters the two numbers, the computer
adds them up, and shows the user the result…
What’s this program flow
diagram???
6. PROGRAM 2
This program is a game. When the game starts, the
computer asks the user their age.
If the user is under 18, the computer says “Sorry, you
can’t play” and the game closes.
If the user is over 18, the computer says “Welcome”,
the first level opens and the user plays. After 20
minutes, the game closes automatically.
What’s this program flow diagram???
8. PROGRAM 3
A program that asks the user for two different
numbers.
When the user enters the two numbers, the
computer compares them and tells the user
which is the highest number.
What’s this program flow
diagram???
10. PROGRAM 4
A program that asks the user for two different
numbers.
When the user enters the two numbers, the
computer first makes sure the numbers are
different.
If they are the same, it asks the user again.
If they are different, it compares them and tells the
user which is the highest number.
What’s this program flow
diagram???
14. EXTRA WORK
If you want to learn more, you can try to design the
flow diagrams of these programs:
PROGRAM 5 An app that ask the user for a password. The app checks if the password is correct. If
not, ask the user to re-write it. If it’s correct, the app opens. The maximum number of tries the
user has is 3. After 3 failures, the app closes saying “Sorry, try again later”.
REAL LIFE SITUATION 2 Your home is at walking distance from school, but you prefer to wait for the
bus. When you arrive to the bus station, you only take the bus if it’s right there or if it’s
approaching the bus stop. If you can’t see the bus, you walk to school.
PROGRAM 6 A program that asks the user for a number. If the number is higher than 10, the
program divides the number per 10 and shows the result. If the number is lower, the computer
says “Sorry, you number must be higher than 10” and ask the user for a number again.
REAL LIFE SITUATION 3 The sequence of actions you perform in a normal school afternoon between
6 pm and 9 pm.