Topic-5 Software Development (Flowchart) (Pre IG) P
Topic-5 Software Development (Flowchart) (Pre IG) P
Topic-5 Software Development (Flowchart) (Pre IG) P
3
Computer systems
• A computer system is made up of software, data, hardware,
communications and people.
• The component parts of any computer system are:
➢ Inputs - the data used by the system that needs to be entered
while the system is active
➢ processes – the tasks that need to be performed using the
input data and any other previously stored data
➢ outputs – information that needs to be displayed or printed for
the users of the system
➢ storage – data that needs to be stored in files on an
appropriate medium for use in the future.
4
Example: an alarm app
• For example, the alarm app can be decomposed into:
❖ inputs – time to set the alarm, remove a previously set alarm
time, switch an alarm off, press snooze button
❖ processes – continuously check if the current time matches an
alarm time that has been set, storage and removal of alarm
times, management of snooze
❖ outputs – continuous sound/tune (at alarm time or after snooze
time expired)
❖ storage – time(s) for alarms set.
5
Methods used to design and construct a solution
to a problem
structure
flowcharts pseudocode.
diagrams
6
Structure diagrams
7
Alarm app
Play sound
Turn alarm Check Reset/clear
Set time for two
on/off off/snooze alarm
minutes
➢Flowcharts are an effective way to communicate how the algorithm that makes
up a system or sub-system works.
9
Checking for the alarm time START
Get Time
Time =
Wait 30
Alarm
seconds
Time?
Sound Alarm
STOP
Fig. Flowchart for check time sub-system
10
Flowcharts symbols
11
Flowcharts symbols
STOP
12
Flowcharts symbols
13
Flowcharts symbols
Process flowcharts
14
Flowcharts symbols
Input and output flowcharts
• The same flowchart symbol is used to show the input of data
and output of information.
OUTPUT
INPUT X “Error”
15
Flowcharts symbols
Decision
Decision flowcharts
• Decision flowchart symbols are
used to decide which action is to
be taken next; these can be used
for selection and repetition/
iteration.
yes
x > B? B x
• There are always two outputs
no
from a decision flowchart
symbol.
16
Activity 1
17
Start
Activity 1
Fill kettle with 1. Fill kettle with water.
water 2. Turn on kettle.
3. Place coffee in cup.
4. Wait for water to boil.
Turn on kettle 5. Pour water into cup.
6. Add milk and sugar.
7. Stir.
Place coffee
in cup
18
Start
Display the
average
End
19
Start
Turn on kettle
Example 2
Draw a flow chart for making a cup of
Is temperature of NO coffee.
water = 100 °C?
YES
Pour water into cup
Stir
Stop 20
Mathematical operators
• The variable on the left of the is assigned the value of the
expression on the right.
Operator Action
+ Add
- Subtract
* Multiply
/ Divide
^ Raise to the power
( ) Group
21
START
Example 3
Enter first
number
Draw a flow chart to calculate total by
Enter second adding first and second numbers.
number
22
START
Example 4
Input num1
Draw a flow chart to calculate total by
Input num2
adding first and second numbers.
sum
STOP
23
START Example 5
Enter first number
Draw a flow chart to calculate total by
Enter second
multiplication of first and second
number numbers.
Output total
STOP
24
START
STOP 25
Example 7
START
STOP
26
Start
Example 8
output "Enter a
number"
No
Yes remainder
== 0?
Stop 27
Example 9
28
Start
input num2
remainder = sum%2
Yes No
remainder == 0?
Stop 29
Example 10
30
Start
input num2
remainder = sum%2
Yes
remainder == 0?
No
output "The result is", sum
31
Stop
Example 11
32
Start
count = 0
count = count + 1
No
num == 56?
Yes
output "You guess the correct
number within", count
Stop
33
Start
Example 12
num = 0
ans = 0
No
num > 100
Yes
Stop
34
Exercise
1. Draw a flow chart to find the product of all positive numbers
between 1 and 100.
2. Draw a flow chart to show the result of multiplying two input
numbers.
3. Draw a flow chart to find the sum of positive integers until the
result is less than 1000.
4. Draw a flow chart to
• Input the marks of three subjects
• Find the total mark
• Decide pass or fail
• Display the total mark and pass or fail
35