SlideShare a Scribd company logo
1 of 20
Download to read offline
1
Chapter 12
FLOWCHARTS
2
Problem Solving
Can be solved in a series of actions
Problem solving steps:
1. Identify the problem
2. Understand the problem
3. Identify alternatives (solutions)
4. Select the best solution4. Select the best solution
5. Prepare a list of steps (instruction)
6. Evaluate the solution
3
SOLUTIONS
Algorithmic Heuristic
the best alternative
solution reached by
completing actions in
steps – algorithm
cannot be reached through
direct set of steps
– require reasoning built on
knowledge & experience
– a process of trial & error
4
Problem Solving with Computers
Solution
instructions listed during
step 5 of problem solving
– must be followed to
produce best results
Result
The outcome
or completed
computer-assisted
answer
Program
Computers deal with algorithmic solutions & heuristic
solutions (artificial intelligence)
Program
set of instructions that
make up the solution
after they have been
coded into a particular
computer language
5
Constants & Variables
Constant
An alphabetical and/or
numerical value that
never changes during the
processing of all the
instructions in a solution
Variable
(identifiers) May
change during
processing
Given a name & a location
in memory
- Referred to by given name
6
Drawing the Flowcharts
Connect blocks by exiting from one
and entering another
The arrowhead is necessary
FLOWLINESFLOWLINES
Indicate the start & end of a
program
StartStart has one flowline exiting
ExitExit has one flowline entering
StartStart
ExitExit
7
Drawing the Flowcharts (cont.)
For calculations,…
Has one flowline entering and one
exiting
PROCESSINGPROCESSING
Indicates input to and output from
the computer memory
Has one entrance & one exit
I/OI/O
8
Drawing the Flowcharts (cont.)
Indicates a decision
Has one entrance & two exits
One exit is the action when the
resultant is TRUE & other exit is the
action when the resultant is FALSEDecisionDecision
i < 10
T F
Display “i is
less than 10”
ExitExit
9
Problem Solving with Computers
Problem: Display Area of a Circle
Steps to solve the problem:
1. Declare & Initialize PI value
2. Declare & Initialize Radius value
3. Declare & Initialize Area value
4. Calculate Area
5. Display the value of Area
10
Drawing the Flowchart & Writing Algorithm
Display Area of a Circle
Start
Declare & initialize
PI, Radius and Area
Algorithm
1. Constant PI = 3.142
2. Variable Radius = 10
Exit
Calculate Area
Display Area
2. Variable Radius = 10
3. Variable Area = 0.0
4. Area = PI x Radius x Radius
5. Display Area
11
Writing the Algorithms
Display Area of a Circle
Algorithm
1. Constant PI = 3.142
2. Variable Radius = 10
3. Variable Area = 0.0
4. Area = PI x Radius x Radius
5. Display Area
…
PI = 3.142
…
…5. Display Area …
Radius = 40
…
Area = 0.0
…
314.2314.2
Output at monitor screen
12
Drawing the Flowchart & Writing Algorithm
Display Area of a Circle
Start
Declare & initialize
PI, Radius and Area
Algorithm
1. Declare Constant PI=3.142,
2. Variable Radius=0
Get Radius
Exit
Calculate Area
Display Area
2. Variable Radius=0
3. Variable Area=0.0
4. Get Radius
5. Area = PI x Radius x Radius
6. Display Area
13
PROGRAM STRUCTUREPROGRAM STRUCTUREPROGRAM STRUCTUREPROGRAM STRUCTURE
14
Program Structure
Use FOUR logic structures to ensure the solution flows
smoothly from one instruction to the next, rather than jumping
between points
1. Sequential structure executes instructions one after another in a
sequence
2. Decision structure branches to execute one of the possible sets of
instructionsinstructions
3. Loop structure executes a set of instructions many times
4. Case structure executes a set of instructions out of several sets
Efficient by providing smooth transformation of data into
information besides eliminating the rewriting of identical
processes
Techniques to improve program readability: the 4 logic
structure, proper naming of variables, internal documentation
and proper indentation
15
Figure 1: Sequential Logic Structure
16
Figure 2: Decision Logic Structure
17
Figure 3: Loop Logic Structure
18
Figure 4: Case Logic Structure
19
Problem Solving with Computers (e.g.)
20
Draw a flowchart to calculate bonus for an employee
based on the following table:
Annual Hours Worked Bonus
Less than 2000 hours RM 500Less than 2000 hours RM 500
Between 2000 and 2499 hours RM 500 + 1 month salary
More than 2500 hours RM500 + 2 months salary

More Related Content

What's hot

Algorithm
AlgorithmAlgorithm
Algorithm
farishah
 
Algorithms and flowcharts
Algorithms and flowchartsAlgorithms and flowcharts
Algorithms and flowcharts
khair20
 
Algorithms and flowcharts ppt (seminar presentation)..
 Algorithms and flowcharts  ppt (seminar presentation).. Algorithms and flowcharts  ppt (seminar presentation)..
Algorithms and flowcharts ppt (seminar presentation)..
Nagendra N
 
Pseudocode-Flowchart
Pseudocode-FlowchartPseudocode-Flowchart
Pseudocode-Flowchart
lotlot
 

What's hot (20)

Algorithm and flowchart with pseudo code
Algorithm and flowchart with pseudo codeAlgorithm and flowchart with pseudo code
Algorithm and flowchart with pseudo code
 
Algorithm & flow chart
Algorithm & flow chartAlgorithm & flow chart
Algorithm & flow chart
 
Algorithm and flowchart
Algorithm and flowchartAlgorithm and flowchart
Algorithm and flowchart
 
Algorithm Development
Algorithm DevelopmentAlgorithm Development
Algorithm Development
 
Algorithm and flowchart
Algorithm and flowchartAlgorithm and flowchart
Algorithm and flowchart
 
Introduction to flowchart
Introduction to flowchartIntroduction to flowchart
Introduction to flowchart
 
Algorithm
AlgorithmAlgorithm
Algorithm
 
Computer programming:Know How to Flowchart
Computer  programming:Know How to FlowchartComputer  programming:Know How to Flowchart
Computer programming:Know How to Flowchart
 
Algorithm and Flowcharts
Algorithm and FlowchartsAlgorithm and Flowcharts
Algorithm and Flowcharts
 
Pseudocode algorithim flowchart
Pseudocode algorithim flowchartPseudocode algorithim flowchart
Pseudocode algorithim flowchart
 
Flowcharting and Algorithm
Flowcharting and Algorithm Flowcharting and Algorithm
Flowcharting and Algorithm
 
Algorithms and flowcharts
Algorithms and flowchartsAlgorithms and flowcharts
Algorithms and flowcharts
 
Algorithms and flowcharts ppt (seminar presentation)..
 Algorithms and flowcharts  ppt (seminar presentation).. Algorithms and flowcharts  ppt (seminar presentation)..
Algorithms and flowcharts ppt (seminar presentation)..
 
Pseudocode-Flowchart
Pseudocode-FlowchartPseudocode-Flowchart
Pseudocode-Flowchart
 
Unit 3 Foc
Unit  3 FocUnit  3 Foc
Unit 3 Foc
 
Chapter 6 algorithms and flow charts
Chapter 6  algorithms and flow chartsChapter 6  algorithms and flow charts
Chapter 6 algorithms and flow charts
 
Algorithms and flowcharts by Haseeb Khan
Algorithms and flowcharts by Haseeb KhanAlgorithms and flowcharts by Haseeb Khan
Algorithms and flowcharts by Haseeb Khan
 
Flowcharts and algorithms
Flowcharts and algorithmsFlowcharts and algorithms
Flowcharts and algorithms
 
Programming flowcharts for C Language
Programming flowcharts for C LanguageProgramming flowcharts for C Language
Programming flowcharts for C Language
 
Introduction to Algorithms & flow charts
Introduction to Algorithms & flow chartsIntroduction to Algorithms & flow charts
Introduction to Algorithms & flow charts
 

Similar to CSC1100 - Chapter12 - Flow Charts

Algorithm for computational problematic sit
Algorithm for computational problematic sitAlgorithm for computational problematic sit
Algorithm for computational problematic sit
Saurabh846965
 
Itc lec5-24+sep+2012
Itc lec5-24+sep+2012Itc lec5-24+sep+2012
Itc lec5-24+sep+2012
Rehan Qadri
 
Algorithm types performance steps working
Algorithm types performance steps workingAlgorithm types performance steps working
Algorithm types performance steps working
Saurabh846965
 

Similar to CSC1100 - Chapter12 - Flow Charts (20)

Algorithm for computational problematic sit
Algorithm for computational problematic sitAlgorithm for computational problematic sit
Algorithm for computational problematic sit
 
Module 1 python.pptx
Module 1 python.pptxModule 1 python.pptx
Module 1 python.pptx
 
Problem solving techniques in c language
Problem solving techniques in c languageProblem solving techniques in c language
Problem solving techniques in c language
 
Problem solving methodology
Problem solving methodologyProblem solving methodology
Problem solving methodology
 
Fundamentals of Programming Chapter 3
Fundamentals of Programming Chapter 3Fundamentals of Programming Chapter 3
Fundamentals of Programming Chapter 3
 
Logic Development and Algorithm.
Logic Development and Algorithm.Logic Development and Algorithm.
Logic Development and Algorithm.
 
Flowcharting week 5 2019 2020
Flowcharting week 5  2019  2020Flowcharting week 5  2019  2020
Flowcharting week 5 2019 2020
 
Itc lec5-24+sep+2012
Itc lec5-24+sep+2012Itc lec5-24+sep+2012
Itc lec5-24+sep+2012
 
UNIT-2-PPTS-DAA.ppt
UNIT-2-PPTS-DAA.pptUNIT-2-PPTS-DAA.ppt
UNIT-2-PPTS-DAA.ppt
 
lecture 5
 lecture 5 lecture 5
lecture 5
 
Introduction to computer science
Introduction to computer scienceIntroduction to computer science
Introduction to computer science
 
C LANGUAGE-FLOWCHARTS,PSEUDOCODE,ALGORITHMS APPROCHES
C LANGUAGE-FLOWCHARTS,PSEUDOCODE,ALGORITHMS APPROCHESC LANGUAGE-FLOWCHARTS,PSEUDOCODE,ALGORITHMS APPROCHES
C LANGUAGE-FLOWCHARTS,PSEUDOCODE,ALGORITHMS APPROCHES
 
Algorithm types performance steps working
Algorithm types performance steps workingAlgorithm types performance steps working
Algorithm types performance steps working
 
Flow charts week 5 2020 2021
Flow charts week 5 2020  2021Flow charts week 5 2020  2021
Flow charts week 5 2020 2021
 
Basic Slides on Algorithms and Flowcharts
Basic Slides on Algorithms and FlowchartsBasic Slides on Algorithms and Flowcharts
Basic Slides on Algorithms and Flowcharts
 
Lecture1-Algorithms-and-Flowcharts-ppt.ppt
Lecture1-Algorithms-and-Flowcharts-ppt.pptLecture1-Algorithms-and-Flowcharts-ppt.ppt
Lecture1-Algorithms-and-Flowcharts-ppt.ppt
 
Pseudo code.pptx
Pseudo code.pptxPseudo code.pptx
Pseudo code.pptx
 
Algorithm.pdf
Algorithm.pdfAlgorithm.pdf
Algorithm.pdf
 
MITx 6.00.1x Introduction to Computer Science and Programming Using Python - ...
MITx 6.00.1x Introduction to Computer Science and Programming Using Python - ...MITx 6.00.1x Introduction to Computer Science and Programming Using Python - ...
MITx 6.00.1x Introduction to Computer Science and Programming Using Python - ...
 
GE3151 PSPP _Unit 1 notes and Question bank.pdf
GE3151 PSPP _Unit 1 notes and Question bank.pdfGE3151 PSPP _Unit 1 notes and Question bank.pdf
GE3151 PSPP _Unit 1 notes and Question bank.pdf
 

More from Yhal Htet Aung

HIT3328 - Chapter0701 - Dialogs, Tabs and Lists
HIT3328 - Chapter0701 - Dialogs, Tabs and ListsHIT3328 - Chapter0701 - Dialogs, Tabs and Lists
HIT3328 - Chapter0701 - Dialogs, Tabs and Lists
Yhal Htet Aung
 
HIT3328 - Chapter0602 - Sketching Apps
HIT3328 - Chapter0602 - Sketching AppsHIT3328 - Chapter0602 - Sketching Apps
HIT3328 - Chapter0602 - Sketching Apps
Yhal Htet Aung
 
HIT3328 - Chapter0601 - Menus and Lists
HIT3328 - Chapter0601 - Menus and ListsHIT3328 - Chapter0601 - Menus and Lists
HIT3328 - Chapter0601 - Menus and Lists
Yhal Htet Aung
 
HIT3328 - Chapter0702 - Navigation Flow and Design Approach
HIT3328 - Chapter0702 - Navigation Flow and Design ApproachHIT3328 - Chapter0702 - Navigation Flow and Design Approach
HIT3328 - Chapter0702 - Navigation Flow and Design Approach
Yhal Htet Aung
 
HIT3328 - Chapter05 - Working with Forms
HIT3328 - Chapter05 - Working with FormsHIT3328 - Chapter05 - Working with Forms
HIT3328 - Chapter05 - Working with Forms
Yhal Htet Aung
 
HIT3328 - Chapter02 - Foundation and Tools
HIT3328 - Chapter02 - Foundation and ToolsHIT3328 - Chapter02 - Foundation and Tools
HIT3328 - Chapter02 - Foundation and Tools
Yhal Htet Aung
 
HIT3328 - Chapter04 - Complex Interactions
HIT3328 - Chapter04 - Complex InteractionsHIT3328 - Chapter04 - Complex Interactions
HIT3328 - Chapter04 - Complex Interactions
Yhal Htet Aung
 
HIT3328 - Chapter03 - Simple Interactive Apps
HIT3328 - Chapter03 - Simple Interactive AppsHIT3328 - Chapter03 - Simple Interactive Apps
HIT3328 - Chapter03 - Simple Interactive Apps
Yhal Htet Aung
 
HIT3328 - Chapter01 - Platforms and Devices
HIT3328 - Chapter01 - Platforms and DevicesHIT3328 - Chapter01 - Platforms and Devices
HIT3328 - Chapter01 - Platforms and Devices
Yhal Htet Aung
 

More from Yhal Htet Aung (20)

HIT3328 - Chapter0701 - Dialogs, Tabs and Lists
HIT3328 - Chapter0701 - Dialogs, Tabs and ListsHIT3328 - Chapter0701 - Dialogs, Tabs and Lists
HIT3328 - Chapter0701 - Dialogs, Tabs and Lists
 
HIT3328 - Chapter0602 - Sketching Apps
HIT3328 - Chapter0602 - Sketching AppsHIT3328 - Chapter0602 - Sketching Apps
HIT3328 - Chapter0602 - Sketching Apps
 
HIT3328 - Chapter0601 - Menus and Lists
HIT3328 - Chapter0601 - Menus and ListsHIT3328 - Chapter0601 - Menus and Lists
HIT3328 - Chapter0601 - Menus and Lists
 
HIT3328 - Chapter0702 - Navigation Flow and Design Approach
HIT3328 - Chapter0702 - Navigation Flow and Design ApproachHIT3328 - Chapter0702 - Navigation Flow and Design Approach
HIT3328 - Chapter0702 - Navigation Flow and Design Approach
 
HIT3328 - Chapter05 - Working with Forms
HIT3328 - Chapter05 - Working with FormsHIT3328 - Chapter05 - Working with Forms
HIT3328 - Chapter05 - Working with Forms
 
HIT3328 - Chapter02 - Foundation and Tools
HIT3328 - Chapter02 - Foundation and ToolsHIT3328 - Chapter02 - Foundation and Tools
HIT3328 - Chapter02 - Foundation and Tools
 
HIT3328 - Chapter04 - Complex Interactions
HIT3328 - Chapter04 - Complex InteractionsHIT3328 - Chapter04 - Complex Interactions
HIT3328 - Chapter04 - Complex Interactions
 
HIT3328 - Chapter03 - Simple Interactive Apps
HIT3328 - Chapter03 - Simple Interactive AppsHIT3328 - Chapter03 - Simple Interactive Apps
HIT3328 - Chapter03 - Simple Interactive Apps
 
HIT3328 - Chapter01 - Platforms and Devices
HIT3328 - Chapter01 - Platforms and DevicesHIT3328 - Chapter01 - Platforms and Devices
HIT3328 - Chapter01 - Platforms and Devices
 
CSC1100 - Chapter11 - Programming Languages and Program Development
CSC1100 - Chapter11 - Programming Languages and Program DevelopmentCSC1100 - Chapter11 - Programming Languages and Program Development
CSC1100 - Chapter11 - Programming Languages and Program Development
 
CSC1100 - Chapter10 - Information System
CSC1100 - Chapter10 - Information SystemCSC1100 - Chapter10 - Information System
CSC1100 - Chapter10 - Information System
 
CSC1100 - Chapter09 - Computer Security, Ethics and Privacy
CSC1100 - Chapter09 - Computer Security, Ethics and PrivacyCSC1100 - Chapter09 - Computer Security, Ethics and Privacy
CSC1100 - Chapter09 - Computer Security, Ethics and Privacy
 
CSC1100 - Chapter08 - Database Management
CSC1100 - Chapter08 - Database ManagementCSC1100 - Chapter08 - Database Management
CSC1100 - Chapter08 - Database Management
 
CSC1100 - Chapter07 - Communications & Networks
CSC1100 - Chapter07 - Communications & NetworksCSC1100 - Chapter07 - Communications & Networks
CSC1100 - Chapter07 - Communications & Networks
 
CSC1100 - Chapter06 - Operating System & Utility Programs
CSC1100 - Chapter06 - Operating System & Utility ProgramsCSC1100 - Chapter06 - Operating System & Utility Programs
CSC1100 - Chapter06 - Operating System & Utility Programs
 
CSC1100 - Chapter05 - Storage
CSC1100 - Chapter05 - StorageCSC1100 - Chapter05 - Storage
CSC1100 - Chapter05 - Storage
 
CSC1100 - Chapter04 - Output
CSC1100 - Chapter04 - OutputCSC1100 - Chapter04 - Output
CSC1100 - Chapter04 - Output
 
CSC1100 - Chapter03 - Input
CSC1100 - Chapter03 - InputCSC1100 - Chapter03 - Input
CSC1100 - Chapter03 - Input
 
CSC1100 - Chapter02 - Components of the System Unit
CSC1100 - Chapter02 - Components of the System UnitCSC1100 - Chapter02 - Components of the System Unit
CSC1100 - Chapter02 - Components of the System Unit
 
CSC1100 - Chapter01 - Overview of Using Computers
CSC1100 - Chapter01 - Overview of Using ComputersCSC1100 - Chapter01 - Overview of Using Computers
CSC1100 - Chapter01 - Overview of Using Computers
 

Recently uploaded

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Victor Rentea
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 

Recently uploaded (20)

2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdf
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 

CSC1100 - Chapter12 - Flow Charts

  • 2. 2 Problem Solving Can be solved in a series of actions Problem solving steps: 1. Identify the problem 2. Understand the problem 3. Identify alternatives (solutions) 4. Select the best solution4. Select the best solution 5. Prepare a list of steps (instruction) 6. Evaluate the solution
  • 3. 3 SOLUTIONS Algorithmic Heuristic the best alternative solution reached by completing actions in steps – algorithm cannot be reached through direct set of steps – require reasoning built on knowledge & experience – a process of trial & error
  • 4. 4 Problem Solving with Computers Solution instructions listed during step 5 of problem solving – must be followed to produce best results Result The outcome or completed computer-assisted answer Program Computers deal with algorithmic solutions & heuristic solutions (artificial intelligence) Program set of instructions that make up the solution after they have been coded into a particular computer language
  • 5. 5 Constants & Variables Constant An alphabetical and/or numerical value that never changes during the processing of all the instructions in a solution Variable (identifiers) May change during processing Given a name & a location in memory - Referred to by given name
  • 6. 6 Drawing the Flowcharts Connect blocks by exiting from one and entering another The arrowhead is necessary FLOWLINESFLOWLINES Indicate the start & end of a program StartStart has one flowline exiting ExitExit has one flowline entering StartStart ExitExit
  • 7. 7 Drawing the Flowcharts (cont.) For calculations,… Has one flowline entering and one exiting PROCESSINGPROCESSING Indicates input to and output from the computer memory Has one entrance & one exit I/OI/O
  • 8. 8 Drawing the Flowcharts (cont.) Indicates a decision Has one entrance & two exits One exit is the action when the resultant is TRUE & other exit is the action when the resultant is FALSEDecisionDecision i < 10 T F Display “i is less than 10” ExitExit
  • 9. 9 Problem Solving with Computers Problem: Display Area of a Circle Steps to solve the problem: 1. Declare & Initialize PI value 2. Declare & Initialize Radius value 3. Declare & Initialize Area value 4. Calculate Area 5. Display the value of Area
  • 10. 10 Drawing the Flowchart & Writing Algorithm Display Area of a Circle Start Declare & initialize PI, Radius and Area Algorithm 1. Constant PI = 3.142 2. Variable Radius = 10 Exit Calculate Area Display Area 2. Variable Radius = 10 3. Variable Area = 0.0 4. Area = PI x Radius x Radius 5. Display Area
  • 11. 11 Writing the Algorithms Display Area of a Circle Algorithm 1. Constant PI = 3.142 2. Variable Radius = 10 3. Variable Area = 0.0 4. Area = PI x Radius x Radius 5. Display Area … PI = 3.142 … …5. Display Area … Radius = 40 … Area = 0.0 … 314.2314.2 Output at monitor screen
  • 12. 12 Drawing the Flowchart & Writing Algorithm Display Area of a Circle Start Declare & initialize PI, Radius and Area Algorithm 1. Declare Constant PI=3.142, 2. Variable Radius=0 Get Radius Exit Calculate Area Display Area 2. Variable Radius=0 3. Variable Area=0.0 4. Get Radius 5. Area = PI x Radius x Radius 6. Display Area
  • 13. 13 PROGRAM STRUCTUREPROGRAM STRUCTUREPROGRAM STRUCTUREPROGRAM STRUCTURE
  • 14. 14 Program Structure Use FOUR logic structures to ensure the solution flows smoothly from one instruction to the next, rather than jumping between points 1. Sequential structure executes instructions one after another in a sequence 2. Decision structure branches to execute one of the possible sets of instructionsinstructions 3. Loop structure executes a set of instructions many times 4. Case structure executes a set of instructions out of several sets Efficient by providing smooth transformation of data into information besides eliminating the rewriting of identical processes Techniques to improve program readability: the 4 logic structure, proper naming of variables, internal documentation and proper indentation
  • 15. 15 Figure 1: Sequential Logic Structure
  • 16. 16 Figure 2: Decision Logic Structure
  • 17. 17 Figure 3: Loop Logic Structure
  • 18. 18 Figure 4: Case Logic Structure
  • 19. 19 Problem Solving with Computers (e.g.)
  • 20. 20 Draw a flowchart to calculate bonus for an employee based on the following table: Annual Hours Worked Bonus Less than 2000 hours RM 500Less than 2000 hours RM 500 Between 2000 and 2499 hours RM 500 + 1 month salary More than 2500 hours RM500 + 2 months salary