Professional Documents
Culture Documents
DESIGN
Algorithm, Flowchart, Pseudocode
and Analyse Problem
2. Planning of variables
variables are simply references to memory locations
a well plan use of variables will produce an efficient
execution of program in terms of speed and memory
utilization
3. Design tools
3 types of design tools
i) Flowchart
ii) pseudo code
4. Program Writing
the program should be clear and readable through an
orderly
5. Documentation
Program must be documented for future references and
maintenance process.
PROCESS
Sequence of interdependent and linked procedures
which, at every stage, consume one or more
resources to convert inputs into outputs.
These outputs then serve as inputs for the next stage
until a known goal or end result is reached.
OUTPUT
The processed data which produced certain result is
known as the output.
The output data will be presented in a sheet of paper
through the printer or display on a monitor.
LETS DO AN EXERCISES:
Determine input, process and output for the given
problems.
1. A workers at TF Supermarket will be paid RM5 per
hour. Get the total hours working per day and total
days working in a month from the user and
calculate the gross pay for a month.
Input :
Output :
Gross pay
Input :
Marks for
a) Quiz 1
b) Quiz 2
c) Test 1
d) Assignment 1
Process :
Output :
Average
12
1. Flowcharts
2
techniques
2. Pseudo Code
13
F
L
O
W
C
H
A
R
T
14
Symbol
Name
Meaning
Flowline
Terminal
Input/output
15
Symbol
Name
Processing
Decision
Connector
Offpage
connector
Meaning
Used for arithmetic and datamanipulation operations. The instruction
are listed inside the symbol
Used for any logic or comparison
operations. Unlike the input/output and
processing symbols, which have one entry
and one exit flowline, the decision symbol
has one entry and
two exit paths. The path chosen depends
on whether the answer to a question is
yes or no
Used to join different flowline
Used to indicate that the flow chart
continues to a second page
16
Symbol
Name
Meaning
Predefined Process
Annotation
EXAMPLE:
1.
Input : ______________________________
Process : _____________________________
Output : _____________________________
START
Display message
How many hours
did you work?
Read Hours
Display message How
much do you get paid
per hour?
Variable Contents:
Hours: ?
Pay Rate: ?
Gross Pay: ?
Multiply Hours by
Pay Rate. Store
result in Gross Pay.
Display Gross Pay
END
Output
Operation
Input
Operation
(User
types 40)
START
Display message
How many hours
did you work?
Read Hours
Display message How
much do you get paid
per hour?
Variable Contents:
Hours: 40
Pay Rate: ?
Gross Pay: ?
END
How much
do you get
paid per
hour?
START
Display message
How many hours did
you work?
Read Hours
Output
Operation
Display message
How much do you
get paid per hour?
Variable Contents:
Hours: 40
Pay Rate: ?
Gross Pay: ?
END
How much do
you get paid
per hour? 20
Display message
How many hours
did you work?
Read Hours
Input
Operation
(User types
20)
Variable Contents:
Hours: 40
Pay Rate: 20
Gross Pay: ?
START
Display message
How much do you
get paid per hour?
END
How much do
you get paid
per hour?
START
Display message
How many hours
did you work?
Read Hours
Display message
How much do you
get paid per hour?
Variable Contents:
Hours: 40
Pay Rate: 20
Gross Pay: 800
END
Process:
The
product
of 40
times 20
is stored
in Gross
Pay
Your gross
pay is 800
START
Display message
How many hours
did you work?
Read Hours
Display message
How much do you
get paid per hour?
Variable Contents:
Hours: 40
Pay Rate: 20
Gross Pay: 800
END
Output
Operation
i) an
abbreviated
version of
actual
computer code
PSEUDO CODE
ii) geometric symbols
used in flowcharts are
replaced by Englishlike statements that
outline the process
iii) allows
programmer to
focus on the
steps required
to solve a
problem rather
than on how to
use computer
language.
Program:
1- Enter hours work - input
2- Enter rate paid per hour input
3. Gross pay=hour * pay rate - process
4. Display gross pay
- output
RUN-TIME ERROR
Run-time errors are errors that occur while your
program runs.
These typically occur when your program attempts
an operation that is impossible to carry out.
LOGICAL ERROR
These errors solely depend on the logical thinking of the
programmer and are easy to detect if we follow the line of
execution and determine why the program takes that path of
execution.
SUMMARY
Design tools for
problem solving:
Flowchart
Pseudo code
Element of problems
analysis:
Input
Process
output
Various types of
errors:
Syntax error
Run-time error
Logical Error
LETS DO AN EXCERCISES
Analyze the problem given, state all the possible variables and
develop a flowchart and pseudo code for each problems.
1.
: _______________________
Process: _____________________
Output: _______________________
: _______________________
Process: _____________________
Output: _______________________
Step 2 : List all posibble variables
___________________________________________
Step 3: Flowcahrt and pseudo-code