SlideShare ist ein Scribd-Unternehmen logo
1 von 30
Program for Problem Solving
Flow Chart
Flowchart is the
individual steps
graphic
or actions to implement
representations of the
a
particular module.
Flowchart can be
building.
linked to the blueprint of a
An architect draws a blueprint before construction
of a building, so the programmer draws a flowchart
before writing a program.
Flowchart is independent of any programming
language.
Drawing Flowcharts
7/29/2019 3
A flow chart is an
organized combination
of shapes, lines and
text that graphically
illustrate a process or
structure.
Flowcharts
7/29/2019 4
Pre-Programming Phase
7/29/2019 5
Sequential Logical Structure
7/29/2019 6
Given the unit price of a product and the quantity
of the product sold, draw a flowchart to calculate
and print the total sale.
Solution: Stepwise Analysis of the Sale Problem
• Read the unit price and the quantity
• Calculate total sale = unit price and
quantity
• Print total sale
START
READ
UNIT PRICE
READ
QUANTITY
A
A
TOTAL SALE =
UNITPRICE  QUANTITY
PRINT
TOTALSALE
STOP
Flowchart Examples
7/29/2019 7
Average
Sum of 2
Numbers
Flowchart for Conditional Expressions
7/29/2019 8
Implements using the IF/THEN/ELSE instruction.
Tells the computer that IF a condition is true, THEN execute a set of
instructions, or ELSE execute another set of instructions.
ELSE part is optional, as there is not always a set of instructions if the
conditions are false.
Algorithm:
IF <condition(s)> THEN
<TRUE instruction(s)>
ELSE
<FALSE instruction(s)
Examples of Conditional Expressions
7/29/2019 9
A < B (A and B are the same data type – either numeric,
character, or string)
X + 5 >= Z (X and Z are numeric data)
E < 5 or F > 10 (E and F are numeric data)
DATAOK (DATAOK – logical datum)
Assume your are calculating pay at an hourly rate, and
overtime pay(over 40 hours) at 1.5 times the hourly rate.
IF the hours are greater than 40, THEN the pay is
calculated for overtime, or ELSE the pay is calculated in
the usual way.
CSE1001
Flowchart for Pay Calculations
7/29/2019 10
CSE1001
Flowchart for Pay Calculations
7/29/2019 11
Nested IF/THEN/ELSE INSTRUCTIONS
Multiple decisions.
Instructions are sets of instruction in which each level of a decision
is embedded in a level before it.
CSE1001
Flowchart for Selections
7/29/2019 12
CSE1001
Flowchart for Iterational Structure
7/29/2019 13
Repeat structure
To solve the problem that doing the same task over and over for
different sets of data.
Types of loop:
WHILE loop
Do..WHILE loop
Automatic-Counter Loop
CSE1001
Flowchart for While Loop
7/29/2019 14
Do the loop body if the condition is true.
Example: Get the sum of 1, 2, 3, … , 100.
Algorithm:
• Set the number = 1
• Set the total = 0
• While (number <= 100)
– total = total + number
– number = number + 1
• End While
• Display total
CSE1001
Flowchart for Automatic Loop
7/29/2019 15
Use variable as a counter that
starts counting at a specified
number
variable
and increments the
each time the loop is
processed.
The beginning value, the ending
value and the increment value
may be constant.
They
during
should not be changed
the processing of the
instruction in the loop.
CSE1001
Flowchart for Automatic Loop
7/29/2019 16
CSE1001
Flowchart for Nested Loop
7/29/2019 17
CSE1001
Flowchart for Nested Loop
7/29/2019 18
CSE1001
Flowchart for Iterational Loop
Write a program to find the average of marks scored by him in three
subjects for ‘N’ students. And then test whether he passed or failed.
For a student to pass, average should not be less than 65.
7/29/2019 19
CSE1001
Tools to draw Flowcharts
7/29/2019 20
Microsoft Visio
Google Docs
Gliffy Flowchart Software
SmartDraw
Creately
Edraw Max
Lucidchart
Cacoo
Flowchart.com
yUML
Diagramly
yEd
Graphviz
SlickPlan
Draw Anywhere
Dia Diagram Editor
SilverDiagram
ArgoUML
Allclear
These are some of the useful tools to create flow chart diagrams,
CSE1001
Programming or Implementation Phase
7/29/2019 21
Transcribing the logical flow of solution steps in flowchart or
algorithm to program code and run the program code on a computer
using a programming language.
Programming phase takes 5 stages:
• Coding.
• Compiling.
• Debugging.
• Run or Testing.
• Documentation and maintenance.
Once the program is coded using one of the programming language, it
will be compiled to ensure there is no syntax error.
Syntax free program will then be executed to produce output and
subsequently maintained and documented for later reference.
CSE1001
Programming or Implementation Phase
7/29/2019 22
DOCUMENTATION OR
MAINTENANCE
EXECUTE OR
RUN
MAKE
C ORRECTION
COMPILE THE
PROGRAM
CODING
NO SYNTAX
ERROR
CSE1001
Programming or Implementation Phase
7/29/2019 23
Coding :
Translation or conversion of each operation in the flowchart or
algorithm (pseudocode) into a computer-understandable language.
Coding should follow the format of the chosen programming language.
Compiling and Debugging
Compiling - Translates a program written in a particular high–level
programming language into a form that the computer can understand.
Compiler checks the program code so that any part of source code that
does not follow the format or any other language requirements will be
flagged as syntax error.
This syntax error in also called bug, when error is found the
programmer will debug or correct the error and then recompile the
source code again
Debugging process is continued until there is no more error in
program(free from errors).
CSE1001
Programming or Implementation Phase
7/29/2019 24
Testing :
The program code that contains no more error is called
executable program. It is ready to be tested.
When it is tested, the data is given and the result is verified so
that it should produced output as intended.
Though the program is error free, sometimes it does not produced
the right result. In this case the program faces logic error.
Incorrect sequence of instruction is an example that causes logic
error.
CSE1001
Programming or Implementation Phase
7/29/2019 25
Documentation and Maintenance
When the program is thoroughly tested for a substantial period of
time and it is consistently producing the right output, it can be
documented.
Documentation is important for future reference. Other
programmer may take over the operation of the program and the
best way to understand a program is by studying the
documentation.
Trying to understand the logic of the program by looking at the
source code is not a good approach.
Studying the documentation is necessary when the program is
subjected to enhancement or modification.
Documentation is also necessary for management use as well as
audit purposes.
CSE1001
Best Practices
7/29/2019 26
CSE1001
Develop efficient computer solution to problems:
1. Use Modules
Use four logic structures
a. Sequential structure
• Executes instructions one after another in a sequence.
b. Decision structure
• Branches to execute one of two possible sets of instructions.
c. Loop structure
• Executes set of instruction many times.
d. Case structure
• Executes one set of instructions out of several sets.
2. Eliminate rewriting of identical process by using modules.
3.Use techniques to improve readability including four logic
structure, proper naming of variables, internal documentation
and proper indentation.
Practice Problem
7/29/2019 27
Draw the Flow chart for the following :
Largest of 2 Numbers.
Largest of 3 Numbers.
Roots of a Quadratic Equation Ax2 + Bx + C.
To perform arithmetic operations.
Display Temperature.
CSE1001
Examples
7/29/2019 28
CSE1001
Examples
7/29/2019 29
CSE1001
7/29/2019 30
CSE1001

Weitere ähnliche Inhalte

Ähnlich wie Draw flow charts to solve problems

Cmis 102 Effective Communication / snaptutorial.com
Cmis 102  Effective Communication / snaptutorial.comCmis 102  Effective Communication / snaptutorial.com
Cmis 102 Effective Communication / snaptutorial.comHarrisGeorg12
 
Cs 568 Spring 10 Lecture 5 Estimation
Cs 568 Spring 10  Lecture 5 EstimationCs 568 Spring 10  Lecture 5 Estimation
Cs 568 Spring 10 Lecture 5 EstimationLawrence Bernstein
 
Lab Report sample of c programming.docx
Lab Report sample of c programming.docxLab Report sample of c programming.docx
Lab Report sample of c programming.docxbheshchaudhary
 
Cmis 102 Enthusiastic Study / snaptutorial.com
Cmis 102 Enthusiastic Study / snaptutorial.comCmis 102 Enthusiastic Study / snaptutorial.com
Cmis 102 Enthusiastic Study / snaptutorial.comStephenson22
 
Cmis 102 Success Begins / snaptutorial.com
Cmis 102 Success Begins / snaptutorial.comCmis 102 Success Begins / snaptutorial.com
Cmis 102 Success Begins / snaptutorial.comWilliamsTaylorza48
 
Introduction to computer science
Introduction to computer scienceIntroduction to computer science
Introduction to computer scienceumardanjumamaiwada
 
JavaScript for ABAP Programmers - 7/7 Functional Programming
JavaScript for ABAP Programmers - 7/7 Functional ProgrammingJavaScript for ABAP Programmers - 7/7 Functional Programming
JavaScript for ABAP Programmers - 7/7 Functional ProgrammingChris Whealy
 
What is algorithm
What is algorithmWhat is algorithm
What is algorithmmshoaib15
 
Methodology Patterns (Agile Cambridge 2014)
Methodology Patterns (Agile Cambridge 2014)Methodology Patterns (Agile Cambridge 2014)
Methodology Patterns (Agile Cambridge 2014)Giovanni Asproni
 
Problem Solving Techniques
Problem Solving TechniquesProblem Solving Techniques
Problem Solving TechniquesAshesh R
 
Stnotes doc 5
Stnotes doc 5Stnotes doc 5
Stnotes doc 5Alok Jain
 
ENGR 131 Elementary Computer ProgrammingTeam IN – Instructor
ENGR 131  Elementary Computer ProgrammingTeam IN – InstructorENGR 131  Elementary Computer ProgrammingTeam IN – Instructor
ENGR 131 Elementary Computer ProgrammingTeam IN – InstructorTanaMaeskm
 
2.2 Demonstrate the understanding of Programming Life Cycle
2.2 Demonstrate the understanding of Programming Life Cycle2.2 Demonstrate the understanding of Programming Life Cycle
2.2 Demonstrate the understanding of Programming Life CycleFrankie Jones
 
10th class computer science notes in english by cstechz
10th class computer science notes in english by cstechz10th class computer science notes in english by cstechz
10th class computer science notes in english by cstechzShahbaz Ahmad
 
Refinery Blending Problems by Engr. Adefami Olusegun
Refinery Blending Problems by Engr. Adefami OlusegunRefinery Blending Problems by Engr. Adefami Olusegun
Refinery Blending Problems by Engr. Adefami OlusegunEngr. Adefami Segun, MNSE
 
Design & Implementation.pptx
Design & Implementation.pptxDesign & Implementation.pptx
Design & Implementation.pptxSalmaItagi2
 

Ähnlich wie Draw flow charts to solve problems (20)

Cmis 102 Effective Communication / snaptutorial.com
Cmis 102  Effective Communication / snaptutorial.comCmis 102  Effective Communication / snaptutorial.com
Cmis 102 Effective Communication / snaptutorial.com
 
Cs 568 Spring 10 Lecture 5 Estimation
Cs 568 Spring 10  Lecture 5 EstimationCs 568 Spring 10  Lecture 5 Estimation
Cs 568 Spring 10 Lecture 5 Estimation
 
Lab Report sample of c programming.docx
Lab Report sample of c programming.docxLab Report sample of c programming.docx
Lab Report sample of c programming.docx
 
Cmis 102 Enthusiastic Study / snaptutorial.com
Cmis 102 Enthusiastic Study / snaptutorial.comCmis 102 Enthusiastic Study / snaptutorial.com
Cmis 102 Enthusiastic Study / snaptutorial.com
 
Cmis 102 Success Begins / snaptutorial.com
Cmis 102 Success Begins / snaptutorial.comCmis 102 Success Begins / snaptutorial.com
Cmis 102 Success Begins / snaptutorial.com
 
lecture 5
 lecture 5 lecture 5
lecture 5
 
Introduction to computer science
Introduction to computer scienceIntroduction to computer science
Introduction to computer science
 
JavaScript for ABAP Programmers - 7/7 Functional Programming
JavaScript for ABAP Programmers - 7/7 Functional ProgrammingJavaScript for ABAP Programmers - 7/7 Functional Programming
JavaScript for ABAP Programmers - 7/7 Functional Programming
 
What is algorithm
What is algorithmWhat is algorithm
What is algorithm
 
Methodology Patterns (Agile Cambridge 2014)
Methodology Patterns (Agile Cambridge 2014)Methodology Patterns (Agile Cambridge 2014)
Methodology Patterns (Agile Cambridge 2014)
 
Beekman5 std ppt_13
Beekman5 std ppt_13Beekman5 std ppt_13
Beekman5 std ppt_13
 
Problem Solving Techniques
Problem Solving TechniquesProblem Solving Techniques
Problem Solving Techniques
 
Stnotes doc 5
Stnotes doc 5Stnotes doc 5
Stnotes doc 5
 
ENGR 131 Elementary Computer ProgrammingTeam IN – Instructor
ENGR 131  Elementary Computer ProgrammingTeam IN – InstructorENGR 131  Elementary Computer ProgrammingTeam IN – Instructor
ENGR 131 Elementary Computer ProgrammingTeam IN – Instructor
 
2.2 Demonstrate the understanding of Programming Life Cycle
2.2 Demonstrate the understanding of Programming Life Cycle2.2 Demonstrate the understanding of Programming Life Cycle
2.2 Demonstrate the understanding of Programming Life Cycle
 
MPP-UPNVJ
MPP-UPNVJMPP-UPNVJ
MPP-UPNVJ
 
10th class computer science notes in english by cstechz
10th class computer science notes in english by cstechz10th class computer science notes in english by cstechz
10th class computer science notes in english by cstechz
 
CostEstimation-1.ppt
CostEstimation-1.pptCostEstimation-1.ppt
CostEstimation-1.ppt
 
Refinery Blending Problems by Engr. Adefami Olusegun
Refinery Blending Problems by Engr. Adefami OlusegunRefinery Blending Problems by Engr. Adefami Olusegun
Refinery Blending Problems by Engr. Adefami Olusegun
 
Design & Implementation.pptx
Design & Implementation.pptxDesign & Implementation.pptx
Design & Implementation.pptx
 

Kürzlich hochgeladen

A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformChameera Dedduwage
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxpboyjonauth
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeThiyagu K
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...EduSkills OECD
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Educationpboyjonauth
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingTechSoup
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxmanuelaromero2013
 
Micromeritics - Fundamental and Derived Properties of Powders
Micromeritics - Fundamental and Derived Properties of PowdersMicromeritics - Fundamental and Derived Properties of Powders
Micromeritics - Fundamental and Derived Properties of PowdersChitralekhaTherkar
 
PSYCHIATRIC History collection FORMAT.pptx
PSYCHIATRIC   History collection FORMAT.pptxPSYCHIATRIC   History collection FORMAT.pptx
PSYCHIATRIC History collection FORMAT.pptxPoojaSen20
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Krashi Coaching
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxOH TEIK BIN
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docxPoojaSen20
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Celine George
 
MENTAL STATUS EXAMINATION format.docx
MENTAL     STATUS EXAMINATION format.docxMENTAL     STATUS EXAMINATION format.docx
MENTAL STATUS EXAMINATION format.docxPoojaSen20
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application ) Sakshi Ghasle
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityGeoBlogs
 
Concept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.CompdfConcept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.CompdfUmakantAnnand
 

Kürzlich hochgeladen (20)

A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy Reform
 
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptx
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Education
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptx
 
Micromeritics - Fundamental and Derived Properties of Powders
Micromeritics - Fundamental and Derived Properties of PowdersMicromeritics - Fundamental and Derived Properties of Powders
Micromeritics - Fundamental and Derived Properties of Powders
 
PSYCHIATRIC History collection FORMAT.pptx
PSYCHIATRIC   History collection FORMAT.pptxPSYCHIATRIC   History collection FORMAT.pptx
PSYCHIATRIC History collection FORMAT.pptx
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptx
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docx
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
 
MENTAL STATUS EXAMINATION format.docx
MENTAL     STATUS EXAMINATION format.docxMENTAL     STATUS EXAMINATION format.docx
MENTAL STATUS EXAMINATION format.docx
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application )
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
Concept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.CompdfConcept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.Compdf
 

Draw flow charts to solve problems

  • 3. Flowchart is the individual steps graphic or actions to implement representations of the a particular module. Flowchart can be building. linked to the blueprint of a An architect draws a blueprint before construction of a building, so the programmer draws a flowchart before writing a program. Flowchart is independent of any programming language. Drawing Flowcharts 7/29/2019 3
  • 4. A flow chart is an organized combination of shapes, lines and text that graphically illustrate a process or structure. Flowcharts 7/29/2019 4
  • 6. Sequential Logical Structure 7/29/2019 6 Given the unit price of a product and the quantity of the product sold, draw a flowchart to calculate and print the total sale. Solution: Stepwise Analysis of the Sale Problem • Read the unit price and the quantity • Calculate total sale = unit price and quantity • Print total sale START READ UNIT PRICE READ QUANTITY A A TOTAL SALE = UNITPRICE  QUANTITY PRINT TOTALSALE STOP
  • 8. Flowchart for Conditional Expressions 7/29/2019 8 Implements using the IF/THEN/ELSE instruction. Tells the computer that IF a condition is true, THEN execute a set of instructions, or ELSE execute another set of instructions. ELSE part is optional, as there is not always a set of instructions if the conditions are false. Algorithm: IF <condition(s)> THEN <TRUE instruction(s)> ELSE <FALSE instruction(s)
  • 9. Examples of Conditional Expressions 7/29/2019 9 A < B (A and B are the same data type – either numeric, character, or string) X + 5 >= Z (X and Z are numeric data) E < 5 or F > 10 (E and F are numeric data) DATAOK (DATAOK – logical datum) Assume your are calculating pay at an hourly rate, and overtime pay(over 40 hours) at 1.5 times the hourly rate. IF the hours are greater than 40, THEN the pay is calculated for overtime, or ELSE the pay is calculated in the usual way. CSE1001
  • 10. Flowchart for Pay Calculations 7/29/2019 10 CSE1001
  • 11. Flowchart for Pay Calculations 7/29/2019 11 Nested IF/THEN/ELSE INSTRUCTIONS Multiple decisions. Instructions are sets of instruction in which each level of a decision is embedded in a level before it. CSE1001
  • 13. Flowchart for Iterational Structure 7/29/2019 13 Repeat structure To solve the problem that doing the same task over and over for different sets of data. Types of loop: WHILE loop Do..WHILE loop Automatic-Counter Loop CSE1001
  • 14. Flowchart for While Loop 7/29/2019 14 Do the loop body if the condition is true. Example: Get the sum of 1, 2, 3, … , 100. Algorithm: • Set the number = 1 • Set the total = 0 • While (number <= 100) – total = total + number – number = number + 1 • End While • Display total CSE1001
  • 15. Flowchart for Automatic Loop 7/29/2019 15 Use variable as a counter that starts counting at a specified number variable and increments the each time the loop is processed. The beginning value, the ending value and the increment value may be constant. They during should not be changed the processing of the instruction in the loop. CSE1001
  • 16. Flowchart for Automatic Loop 7/29/2019 16 CSE1001
  • 17. Flowchart for Nested Loop 7/29/2019 17 CSE1001
  • 18. Flowchart for Nested Loop 7/29/2019 18 CSE1001
  • 19. Flowchart for Iterational Loop Write a program to find the average of marks scored by him in three subjects for ‘N’ students. And then test whether he passed or failed. For a student to pass, average should not be less than 65. 7/29/2019 19 CSE1001
  • 20. Tools to draw Flowcharts 7/29/2019 20 Microsoft Visio Google Docs Gliffy Flowchart Software SmartDraw Creately Edraw Max Lucidchart Cacoo Flowchart.com yUML Diagramly yEd Graphviz SlickPlan Draw Anywhere Dia Diagram Editor SilverDiagram ArgoUML Allclear These are some of the useful tools to create flow chart diagrams, CSE1001
  • 21. Programming or Implementation Phase 7/29/2019 21 Transcribing the logical flow of solution steps in flowchart or algorithm to program code and run the program code on a computer using a programming language. Programming phase takes 5 stages: • Coding. • Compiling. • Debugging. • Run or Testing. • Documentation and maintenance. Once the program is coded using one of the programming language, it will be compiled to ensure there is no syntax error. Syntax free program will then be executed to produce output and subsequently maintained and documented for later reference. CSE1001
  • 22. Programming or Implementation Phase 7/29/2019 22 DOCUMENTATION OR MAINTENANCE EXECUTE OR RUN MAKE C ORRECTION COMPILE THE PROGRAM CODING NO SYNTAX ERROR CSE1001
  • 23. Programming or Implementation Phase 7/29/2019 23 Coding : Translation or conversion of each operation in the flowchart or algorithm (pseudocode) into a computer-understandable language. Coding should follow the format of the chosen programming language. Compiling and Debugging Compiling - Translates a program written in a particular high–level programming language into a form that the computer can understand. Compiler checks the program code so that any part of source code that does not follow the format or any other language requirements will be flagged as syntax error. This syntax error in also called bug, when error is found the programmer will debug or correct the error and then recompile the source code again Debugging process is continued until there is no more error in program(free from errors). CSE1001
  • 24. Programming or Implementation Phase 7/29/2019 24 Testing : The program code that contains no more error is called executable program. It is ready to be tested. When it is tested, the data is given and the result is verified so that it should produced output as intended. Though the program is error free, sometimes it does not produced the right result. In this case the program faces logic error. Incorrect sequence of instruction is an example that causes logic error. CSE1001
  • 25. Programming or Implementation Phase 7/29/2019 25 Documentation and Maintenance When the program is thoroughly tested for a substantial period of time and it is consistently producing the right output, it can be documented. Documentation is important for future reference. Other programmer may take over the operation of the program and the best way to understand a program is by studying the documentation. Trying to understand the logic of the program by looking at the source code is not a good approach. Studying the documentation is necessary when the program is subjected to enhancement or modification. Documentation is also necessary for management use as well as audit purposes. CSE1001
  • 26. Best Practices 7/29/2019 26 CSE1001 Develop efficient computer solution to problems: 1. Use Modules Use four logic structures a. Sequential structure • Executes instructions one after another in a sequence. b. Decision structure • Branches to execute one of two possible sets of instructions. c. Loop structure • Executes set of instruction many times. d. Case structure • Executes one set of instructions out of several sets. 2. Eliminate rewriting of identical process by using modules. 3.Use techniques to improve readability including four logic structure, proper naming of variables, internal documentation and proper indentation.
  • 27. Practice Problem 7/29/2019 27 Draw the Flow chart for the following : Largest of 2 Numbers. Largest of 3 Numbers. Roots of a Quadratic Equation Ax2 + Bx + C. To perform arithmetic operations. Display Temperature. CSE1001