Lesson 2 algorithm and flowcharts
-
Upload
christopher-olaya -
Category
Education
-
view
222 -
download
8
Transcript of Lesson 2 algorithm and flowcharts
![Page 1: Lesson 2 algorithm and flowcharts](https://reader035.fdocuments.in/reader035/viewer/2022081422/55b6d2eebb61eb81418b47bf/html5/thumbnails/1.jpg)
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
![Page 2: Lesson 2 algorithm and flowcharts](https://reader035.fdocuments.in/reader035/viewer/2022081422/55b6d2eebb61eb81418b47bf/html5/thumbnails/2.jpg)
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
![Page 3: Lesson 2 algorithm and flowcharts](https://reader035.fdocuments.in/reader035/viewer/2022081422/55b6d2eebb61eb81418b47bf/html5/thumbnails/3.jpg)
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
![Page 4: Lesson 2 algorithm and flowcharts](https://reader035.fdocuments.in/reader035/viewer/2022081422/55b6d2eebb61eb81418b47bf/html5/thumbnails/4.jpg)
Sample Activity
1. Create an Algorithm for the following:
a. Turning on the computer. b. Enrollment procedure to a school.
![Page 5: Lesson 2 algorithm and flowcharts](https://reader035.fdocuments.in/reader035/viewer/2022081422/55b6d2eebb61eb81418b47bf/html5/thumbnails/5.jpg)
Assignment Activity1. Create an Algorithm for
cooking Sinigang na Baboy.
![Page 6: Lesson 2 algorithm and flowcharts](https://reader035.fdocuments.in/reader035/viewer/2022081422/55b6d2eebb61eb81418b47bf/html5/thumbnails/6.jpg)
![Page 7: Lesson 2 algorithm and flowcharts](https://reader035.fdocuments.in/reader035/viewer/2022081422/55b6d2eebb61eb81418b47bf/html5/thumbnails/7.jpg)
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.
![Page 8: Lesson 2 algorithm and flowcharts](https://reader035.fdocuments.in/reader035/viewer/2022081422/55b6d2eebb61eb81418b47bf/html5/thumbnails/8.jpg)
Advantage of Flowchart Learned and applied without formal
knowledge of a programming language.
Provide an alternative to the usual narrative description.
Easier to understand
![Page 9: Lesson 2 algorithm and flowcharts](https://reader035.fdocuments.in/reader035/viewer/2022081422/55b6d2eebb61eb81418b47bf/html5/thumbnails/9.jpg)
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.
![Page 10: Lesson 2 algorithm and flowcharts](https://reader035.fdocuments.in/reader035/viewer/2022081422/55b6d2eebb61eb81418b47bf/html5/thumbnails/10.jpg)
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.
![Page 11: Lesson 2 algorithm and flowcharts](https://reader035.fdocuments.in/reader035/viewer/2022081422/55b6d2eebb61eb81418b47bf/html5/thumbnails/11.jpg)
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.
![Page 12: Lesson 2 algorithm and flowcharts](https://reader035.fdocuments.in/reader035/viewer/2022081422/55b6d2eebb61eb81418b47bf/html5/thumbnails/12.jpg)
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.
![Page 13: Lesson 2 algorithm and flowcharts](https://reader035.fdocuments.in/reader035/viewer/2022081422/55b6d2eebb61eb81418b47bf/html5/thumbnails/13.jpg)
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
![Page 14: Lesson 2 algorithm and flowcharts](https://reader035.fdocuments.in/reader035/viewer/2022081422/55b6d2eebb61eb81418b47bf/html5/thumbnails/14.jpg)
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.
![Page 15: Lesson 2 algorithm and flowcharts](https://reader035.fdocuments.in/reader035/viewer/2022081422/55b6d2eebb61eb81418b47bf/html5/thumbnails/15.jpg)
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.
![Page 16: Lesson 2 algorithm and flowcharts](https://reader035.fdocuments.in/reader035/viewer/2022081422/55b6d2eebb61eb81418b47bf/html5/thumbnails/16.jpg)
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.