270 likes | 283 Views
Learn about flowchart programming tools, including symbols, rules, advantages, and limitations. Understand how flowcharts help in converting algorithms into computer programs.
E N D
Lecture 4 Flowchart
Programming Tools • Three tools are used to convert algorithms into computer programs: • Flowchart- Graphically depicts the logical steps to carry out a task and shows how the steps relate to each other. • Pseudocode- Uses English-like phrases with some Visual Basic terms to outline the program.
Outline • Flowcharting Symbols • General Rules for flowcharting • Advantages of Flowcharts • Limitations of Flowcharts • Flowcharting Tips
Flowcharts • Flowchart is the graphic representations of the individual steps or actions to implement a particular module. • The flowchart can be likened to the blueprint of a building. An architect draws a blueprint before beginning construction on a building, so the programmer draws a flowchart before writing a program. • Flowchart is independent of any programming language.
Flowcharts • Flowchart is the logical design of a program. • It is the basis from which the actual program code is developed. • Flowchart serves as documentation for computer program. • Graphically depict the logical steps to carry out a task and show how the steps relate to each other. • The flowchart must be drawn according to definite rules and utilizes standard symbols adopted internationally. CS202
Counter A B S CS202
START END Display message “How many hours did you work?” Display message “How much do you get paid per hour?” Read Hours Read PayRate Multiply Hours by PayRate. Store result in GrossPay. Display GrossPay What is a Flowchart? • A flowchart is a diagram that depicts the “flow” of a program. • The figure shown here is a flowchart for the pay-calculating program
START END Display message “How many hours did you work?” Display message “How much do you get paid per hour?” Read Hours Read PayRate START END Display GrossPay Terminal • Terminals • represented by rounded rectangles • indicate a starting or ending point Multiply Hours by PayRate. Store result in GrossPay. Terminal
START END Display message “How many hours did you work?” Display message “How much do you get paid per hour?” Read Hours Read PayRate Display message “How many hours did you work?” Read Hours Display GrossPay • Input/Output Operations • represented by parallelograms • indicate an input or output operation Input/Output Operation Multiply Hours by PayRate. Store result in GrossPay.
START END Display message “How many hours did you work?” Display message “How much do you get paid per hour?” Read Hours Read PayRate Display GrossPay • Processes • represented by rectangles • indicates a process such as a mathematical computation or variable assignment Multiply Hours by PayRate. Store result in GrossPay. Process Multiply Hours by PayRate. Store result in GrossPay.
Flowchart example (2) • Example : Sale Problem • Draw a flowchart for a problem that to read two numbers. The first number represents the unit price of a product and the second number represents the quantity of the product sold. Calculate and print the total sale. • Solution: Stepwise Analysis of the Sale Problem • Start of processing • Read the unit price • Read the quantity • Calculate total sale • Print total sale • Stop the processing CS202
READ QUANTITY START STOP READ PRICE PRINT SALE SALE = PRICE ´ QUANTITY CS202
START A READ UNIT PRICE TOTAL SALE = UNIT PRICE ´ QUANTITY READ QUANTITY PRINT TOTAL SALE STOP A CS202
Flowchart example (3) Program: Determine the direction of a numbered NYC street Eastbound or Westbound
Flowchart example (4) Problem: Calculate and report the grade-point average for a class
Communication: Flowcharts are better way of communicating the logic of a system to all concerned. Effective analysis: With the help of flowchart, problem can be analysed in more effective way. Proper documentation: Program flowcharts serve as a good program documentation, which is needed for various purposes. Flowchart Advantages
Efficient Coding: The flowcharts act as a guide or blueprint during the systems analysis and program development phase. Proper Debugging: The flowchart helps in debugging process. Efficient Program Maintenance: The maintenance of operating program becomes easy with the help of flowchart. Flowchart Advantages
LIMITATIONS OF USING FLOWCHARTS • Complex logic: Sometimes, the program logic is quite complicated. In that case, flowchart becomes complex and clumsy. • Alterations and Modifications: If alterations are required the flowchart may require re-drawing completely. • Reproduction: As the flowchart symbols cannot be typed, reproduction of flowchart becomes a problem. • The essentials of what is done can easily be lost in the technical details of how it is done.
Tips and tricks of flowcharts • Flowcharts are time-consuming to write and difficult to update • For this reason, professional programmers are more likely to favor pseudocode and hierarchy charts • Because flowcharts so clearly illustrate the logical flow of programming techniques, they are a valuable tool in the education of programmers
Tips and tricks of flowcharts • In drawing a proper flowchart, all necessary requirements should be listed out in logical order. • The flowchart should be clear, neat and easy to follow. • There should not be any room for ambiguity in understanding the flowchart. • The usual direction of the flow of a procedure or system is from left to right or top to bottom. • Only one flow line should come out from a process symbol
Flowcharting software • Flow-charts can be created by hand or manually in most office software, but lately specialized diagram drawing software has emerged that can also be used for the purpose
URL’s for free Flowcharting software • www.smartdraw.com • www.gliffy.com/uses/flowchart-software/ • www.breezetree.com/flowcharting-software/ Flowchart Software, FREE Flowchart Examples and Templates ... • www.edrawsoft.com/flowchart.php
Flowchart example (5) Obtain a series of positive numbers from the keyboard, and determine and display their sum. Assume that the user types the sentinel value -1 to indicate "end of data entry"
Tutorial • What do each of the following symbols represent? (Answer on next slide)
Tutorial • What do each of the following symbols represent? Decision Terminal Input/Output Operation Connector Module Process