Lesson 5 - Lecture in Algorithm and Flowcharting: Introduction To Programming Languages
Lesson 5 - Lecture in Algorithm and Flowcharting: Introduction To Programming Languages
Implementation
SDLC
-training
Design
-conversion
-preliminary design
-evaluation
-detail design
-maintenance
Development
-scheduling
-programming
-testing
Computer Program
Is a set of detailed, step-by-step instructions that
directs the computer what you want it to do. It is
a notation for expressing instructions to be
carried out by a computer.
Programs are written in a programming language,
which is a set of rules that provides a way of
telling the computer what operations to perform.
The person who creates computer program is
called computer programmer.
Activities Involve in
Programming
Understand the problem.
Plan the logic.
Code the program.
Compile the program into machine
language.
Test the program.
Put the program into production.
Activities involve in
Programming
Understanding the Problem
To execute and then run the program. The program upon execution
is being subjected to different kinds of test data to anticipate and
correct errors that might occur before releasing the program to the
users.
Errors can be classified into two: (1) syntactical or logical errors (2)
compile or run-time errors.
Activities involve in
Programming
Put the Program into Production
Program Flowcharts
Depicts the detailed logical flow of process in a program.
System Flowcharts
Shows the logic flow of data from one source to another.
Divided into functions of departments or personnel.
Symbols are used to represent documents used and
operations undertaken.
Highlights excessive information flow, duplication of
information stored in different locations and reasons for
delay of transactions.
Flowcharting
Basic Flowcharting Symbols
Terminal block
On-page Connector
Process symbol
Off-page Connector
Input/Output block
Initialization symbol
Terminal
OVAL - used to signify the beginning
and end of flowchart
START
Flowcharting
Basic Flowcharting Symbols
Preparation/Initialization
Input/Output
Parallelogram
-shows input and output.
Data are to be read into the
computer memory from an
input device or data are to
Read A be passed from the memory
Print A to an output device.
Flowcharting
Basic Flowcharting Symbols
Process/Processing
Rectangle
-performs any calculations hat
are to be done.
Sum = A+B
Flowcharting
Basic Flowcharting Symbols
Decision
On-page Connector
Off-page Connector
Flowlines
standard convention.
Input operation are represented in a parallelogram. A
Variables that can hold letters of the alphabet and other special
NAME = “WASHINGTON”
Logical or Boolean Variables
A special type of variable that can only have two values - TRUE or
FALSE.
Flowcharting
Arithmetic Operators and Mathematical Statements
Addition (+)
Subtraction (-)
Multiplication (*)
Division (/)
Modulus (%)
x=x+1
sum = a + b
Flowcharting
Constants
A constant is a value that never changes during the
execution of the program.
Constants can be any type-numeric, alphabetic or
special symbols.
Like variable, constants can be named. The computer
sets up a specific memory location to hold the value of
the constant.
During the execution of the program, the constant is
referred to by name. Once the constant is given a
value, it cannot be changed during the execution of
the program.
Flowcharting
Relational Operator
A relational operator compares two values and
determines the relationship between them.
START
Algorithm:
Step 1: Read in the value of N.
READ N
Step 2: Print the value of N.
PRINT N
END
Draw a flowchart that will compute and display the sum and
product of two numbers. Write its equivalent algorithm.
START Algorithm:
Step 1: Initialize Sum and Product
into 0.
Sum = 0 Step 2: Read in the values of A and
Product = 0 B.
Step 3: Compute the sum by
adding A and B then compute the
Read A,B
product by multiplying A and B.
Step 4: Print the computed value of
Sum and Product.
START Algorithm:
Step 1: Initialize Celsius into 0.
Step 2: Read in the value of
Celsius=0 Fahrenheit.
Step 3: Compute the value of
Celsius.
Read Fah Step 4: Print the computed value of
Celsius.
Celsius=(5/9)*
(Fah-32) Print
END
Celsius
Draw a flowchart that will input values for A and B. Compare two
values inputted and print which of the values is higher including the
remark “Higher”. Write its equivalent algorithm.
Algorithm:
START Step 1: Read the values of A and B.
Step 2: Test if A is greater than B.
Step 3: If A is greater than B, A is higher.
However, if A is less than B, B is higher.
Input A,B Step 4: Print the number and the remark
“Higher”
T
A>B Print A,
“Higher”
F
Print B, END
“Higher”
Draw a flowchart that will input grade of student and determine
whether the grade is passed or failed. Print the name, grade and
remarks of student. Write its equivalent algorithm.
START Algorithm:
Step 1: Initialize name and remarks into blanks.
Step 2: Read in values for Grade and Name.
Step 3: Test if Grade is greater than or equal to 60.
Step 4: If Grade is greater than or equal to 60,
Name=“ “ remark is “Passed”. However, if Grade is below
Remarks = “ “ 60, remark is “Failed”.
Step 5: Print the name, grade and remarks.
Read Name,
Grade
If Grade Remarks =
>60 “Passed”