lesson 2 algorithm and flowcharts
TRANSCRIPT
START
Jack up the Car
Unscrew the lugs
Remove the wheel
Spare Tire?
Put on Spare
Screw the lugs
Jack the Car down
Go to Vulcanizing
shop
A
A
END
YN
Usual process of changing a flat tire1.Jack up the Car2.Unscrew the lugs3.Remove the wheel4.Any Spare tires?5.If none go to vulcanizing shop6. If there is Put on the Spare7.Screw on the lugs8.Jack the car down
Algorithm
A list of instructions for carrying out some process step by step.
Algorithms can combine millions of elementary steps, such as additions and subtractions, into a complicated mathematical calculations.
Example of an Algorithm:1.A recipe in a cookbook2.A dance choreography
Sample AlgorithmUsual process of changing a flat tire:1.Jack up the Car2.Unscrew the lugs3.Remove the wheel4.Any Spare tires?5.If none, go to vulcanizing shop, If there is Put on the Spare6.Screw on the lugs7.Jack the car down
Sample Activity
1. Create an Algorithm for the following:
a. Turning on the computer. b. Enrollment procedure to a school.
Assignment Activity1. Create an Algorithm for
cooking Sinigang na Baboy.
Flowcharts
Is a diagram representing the logical sequence in which a combination of steps or operations is to be performed.
Major Uses: For Documentation- aids in
communicating the nature of the operation.
For Program Development – that is organizing facts, outline problems and deals with it systematically, build step by step reference documentation and reminders.
Advantage of Flowchart Learned and applied without formal
knowledge of a programming language.
Provide an alternative to the usual narrative description.
Easier to understand
Limitations of Flowchart Do not represent a
programming language. It does not convey why a given
set of operations is made, flowchart only portray how.
Do not highlight important details.
Flowchart Symbols Input/Output Symbol –
represents an instruction to an input or an output device.
Processing Symbol – perform processing functions of the program such as arithmetic opera- tions, compare, sort etc.
Denotes a point of the program where more than one path can be taken.
Flowchart Symbols Preparation Symbol –
represents instruction that will alter or modify a program’s course of execution.
Terminal Symbol – used to designate the beginning and end of the program.
On-Page connector – nonprocessing symbol used to connect one part of a flowchart.
Flowchart Symbols Flow Direction Indicator – used
to show the direction of the processing of data flow.
Flow Lines – used to show reading order or sequence in which symbols are to be read.
Off-page Connector – Designate entry to or exit from a page when a flowchart requires more than one page.
Sample FloWcHartSTART
Jack up the Car
Unscrew the lugs
Remove the
wheel
Spare Tire?
Put on Spare
Screw the lugs
Jack the Car down
Go to Vulcanizing
shop
A
A
END
YN
Sample Problem The radius of a circle is equal
to one unit. Create an Algorithm and flowchart to compute the corresponding area of the circle and print out the value of the radius and the area.
Activity Problem Given three numbers A, B, and
C. Draw a flowchart to compute for the sum, the average, and the product of these value. Print out all the results.
Assignment: The PINAHIS Manufacturing Company plans
to give a year-end bonus to each of its employees. Draw a flowchart and an algorithm which will compute the bonus of an employee. Consider the following criteria: If the employee’s monthly salary is less than 1,ooo pesos, the bonus is 50% of the salary; for employees with salaries greater than 1,000 pesos, the bonus is 1,000. Print out the name and corresponding bonus of the employee.