Upload
li-anne-serrano
View
797
Download
3
Tags:
Embed Size (px)
DESCRIPTION
Citation preview
FlowchartingIT 12 | Fundamentals of Programming and Database Theory and Applications
Ms. Jennifer O. Calleja | IT Instructor
Objectives
Upon completion of this chapter, you should be able to:
• Know the main steps for problem solving.
• Define term flowchart.• List and discus advantages and
disadvantages of flowchart as a logic development tool.
• Solve word problems using flowcharts.
Ms. Jennifer O. Calleja | IT Instructor
Steps in Problem solving
1. The first step in problem solving is to define the problem. The problem statement should be examined carefully to fully determine what question should be answered.
For example, consider this problem. A farmer had 100 chicken and all but 20 of them died. How many chicken does the farmer have left?
Ms. Jennifer O. Calleja | IT Instructor
Steps in Problem solving
2. After the problem is defined, the next step is to assemble all given data and to assign variable names to those quantities which are unknown. example:
Like the following statement: Let r = the radius of the circle
Ms. Jennifer O. Calleja | IT Instructor
Steps in Problem solving
3. Next, all unnecessary information should be discarded. Many problems contain information which has no meaning to the solution.
Consider this problem: A man received a check for 300 thousand pesos
of which he deposited 120 thousand pesos into his account. If his account balance was 200 thousand pesos after this deposit, how much was his balance before the deposit?
Ms. Jennifer O. Calleja | IT Instructor
Steps in Problem solving
•4. The next step is to discover relationships between the data express these relationships as equations.
Ms. Jennifer O. Calleja | IT Instructor
Steps in Problem solving
For example, read the radius of the circle from the keyboard then find its area and circumference.
Let R = the radius of the circleLet A = the area of the circleLet C = the circumference of the circleThus,A = π * r * rC = 2 * π * rRepresents the relationships in the problem
Ms. Jennifer O. Calleja | IT Instructor
Steps in Problem solving
5. The final step of problem solving is to arrange the equations into an algorithm. After the algorithm is established, the actual procedures may be executed by either the computer or manually.
Ms. Jennifer O. Calleja | IT Instructor
Flowchart
•a tool developed in the computer industry, for showing the steps involved in a process.
• A flowchart is a diagram made up of boxes, diamonds and other shapes, connected by arrows - each shape represents a step in the process, and the arrows show the order in which they occur.
Ms. Jennifer O. Calleja | IT Instructor
Flowcharting Symbols
Ms. Jennifer O. Calleja | IT Instructor
Process
Indicates any type of internal operation inside the
Processor or Memory
Input|output
Used for any Input / Output (I/O) operation. Indicates that the computer is to
obtain data or output results
Flowcharting Symbols
Ms. Jennifer O. Calleja | IT Instructor
Decision
Used to ask question that can be answered by True or
false | yes or no
connector
Allows the flowchart to be drawn without intersecting lines or without a reverse
flow
Flowcharting Symbols
Ms. Jennifer O. Calleja | IT Instructor
Terminal
Indicates the starting or ending of the program process or interrupt
program
Flow lines
Shows direction of flow
General Rules for Flowcharting
•The flowchart should be clear, neat and easy to follow.
•The usual direction of the flow of a procedure or a system is from left to right or top to bottom.
•Only one flow line should come out or from a process symbol.
Ms. Jennifer O. Calleja | IT Instructor
General Rules for Flowcharting
•Only one flow line should enter a decision symbol, but two or three flow lines, one for each possible answer, should leave the decision symbol.
•Only one flow line is used in conjunction with terminal symbol.
Ms. Jennifer O. Calleja | IT Instructor
General Rules for Flowcharting
•All boxes of the flowchart are connected with arrows
•Flowchart symbols have an entry point on the top of the symbol with no other entry points. The exit point for all flowchart symbols is on the bottom except for the DECISION SYMBOL.
•The Decision Symbol has two exit points; these can be on the sides or the bottom and one side.
Ms. Jennifer O. Calleja | IT Instructor
Advantages of Flowcharting•Good way of Communicating•Effective analysis•Proper documentation•Efficient coding•Proper debugging•Efficient program maintenance
Ms. Jennifer O. Calleja | IT Instructor
Draw a flowchart to find the sum of first 10 natural numbers.
This means that we want to find sum where sum is given by:Sum = 1 + 2 + 3 + ………………… 9 + 10.
Ms. Jennifer O. Calleja | IT Instructor
Pseudocode
•is one of the tools that can be used to write a preliminary plan that can be developed into a computer program
•a generic way of describing an algorithm without use of any specific programming language syntax.
Ms. Jennifer O. Calleja | IT Instructor