SlideShare a Scribd company logo
1 of 27
Download to read offline
Lect 3 P. 1
Engineering H192 - Computer Programming
Winter Quarter
The Ohio State University
Gateway Engineering Education Coalition
Structured Engineering Problem Solving and
Logic Diagrams
Lecture 3
Lect 3 P. 2
Engineering H192 - Computer Programming
Winter Quarter
The Ohio State University
Gateway Engineering Education Coalition
TOOLS FOR PROGRAM DEVELOPMENT
• A variety of tools and techniques can be used in
the process of program development
• Useful for organizing the tasks in problem
solving
• Many of the tools are focused on the:
– development or formulation of algorithms
– representation of algorithms
– refinement or structuring of algorithms
Lect 3 P. 3
Engineering H192 - Computer Programming
Winter Quarter
The Ohio State University
Gateway Engineering Education Coalition
TOOLS FOR PROGRAM DEVELOPMENT
• Top-down design technique
– Start with overall function and perform several
step-wise refinements
• Pseudo code
– Artificial and informal language that helps
programmers develop algorithms
• Logic diagrams
– Alternate representations of algorithms
including graphic and state representations
Lect 3 P. 4
Engineering H192 - Computer Programming
Winter Quarter
The Ohio State University
Gateway Engineering Education Coalition
TOP-DOWN STEPWISE REFINEMENT
• Begin with a single statement that conveys the
overall function of the program. This is a
complete (but simple) representation of the
program.
• Divide this "top" statement into a series of
smaller tasks and list them in the order in which
they must be performed to produce a first
refinement.
Lect 3 P. 5
Engineering H192 - Computer Programming
Winter Quarter
The Ohio State University
Gateway Engineering Education Coalition
TOP-DOWN STEPWISE REFINEMENT
• Next, refine each of the smaller tasks into yet
smaller steps, defining specific "variables" as
may be needed in this second refinement.
• Continue refinement until algorithm is fully
developed.
• When combined with pseudo code, writing the
program is normally straightforward.
Lect 3 P. 6
Engineering H192 - Computer Programming
Winter Quarter
The Ohio State University
Gateway Engineering Education Coalition
Top-Down Example
• The Problem:
The students in a class have taken their first quiz.
The grades (in the range of 0 to 100) are
available. Determine the class average on the
quiz.
• Givens:
Grades, Possible range of legitimate grades.
Lect 3 P. 7
Engineering H192 - Computer Programming
Winter Quarter
The Ohio State University
Gateway Engineering Education Coalition
Top-Down Example (continued)
• Unknowns:
How many grades to be averaged?
• Assumptions:
A "grade" not in the range of expected grades
could be used to indicate the that all of the
legitimate grades have been entered. (Called
"sentinel" or "flag".)
Lect 3 P. 8
Engineering H192 - Computer Programming
Winter Quarter
The Ohio State University
Gateway Engineering Education Coalition
Top-Down Example (continued)
• Using pseudo code, we begin by representing the
top:
– Determine the class average for the quiz
Lect 3 P. 9
Engineering H192 - Computer Programming
Winter Quarter
The Ohio State University
Gateway Engineering Education Coalition
Top-Down Example (continued)
• Next, perform the first refinement:
– Determine the class average for the quiz
• Initialize variables
• Input, sum, and count quiz grades
• Calculate and print the class average
Lect 3 P. 10
Engineering H192 - Computer Programming
Winter Quarter
The Ohio State University
Gateway Engineering Education Coalition
Top-Down Example (continued)
• Next, refine each one of these smaller tasks:
– Initialize variables
• Initialize a running total to zero
• Initialize a grade counter to zero
Lect 3 P. 11
Engineering H192 - Computer Programming
Winter Quarter
The Ohio State University
Gateway Engineering Education Coalition
Top-Down Example (continued)
Input, sum, and count quiz grades
Input the first grade
While the user has not entered the "flag"
Add this grade into the running total
Add one to the grade counter
Input next grade (possibly the "flag")
Lect 3 P. 12
Engineering H192 - Computer Programming
Winter Quarter
The Ohio State University
Gateway Engineering Education Coalition
Top-Down Example (continued)
Calculate and print the class average
If the grade counter is not zero
Set the class average to the running
total divided by the grade counter
Print the average
Else
Print "No grades were entered"
Lect 3 P. 13
Engineering H192 - Computer Programming
Winter Quarter
The Ohio State University
Gateway Engineering Education Coalition
Handling Special Cases
• Notice that the top-down refinement example
included the handling of a "special case".
• Many of you are aware of the special treatment
that Windows gives to the extreme "special
cases" (sometimes called the BSOD or Blue
Screen of Death…)
Lect 3 P. 14
Engineering H192 - Computer Programming
Winter Quarter
The Ohio State University
Gateway Engineering Education Coalition
Handling Special Cases
Lect 3 P. 15
Engineering H192 - Computer Programming
Winter Quarter
The Ohio State University
Gateway Engineering Education Coalition
Some Types of Logic Diagrams
• Flow Charts -- graphic representation of an
algorithm
– an aid to writing the program
– no formal standards, but common guidelines
• Action Diagrams -- technique for diagramming of
control structures of a program
– an outline of the computer application
– what things happen, when, where, how many
times
Lect 3 P. 16
Engineering H192 - Computer Programming
Winter Quarter
The Ohio State University
Gateway Engineering Education Coalition
Characteristics of Flow Charts
• Useful tool in program development
• Not a complete description of program
• Not only tool to use
• Made before writing the program
• Program might differ from flowchart
• Only executable statements are shown
• Specific equations and tests not included
• Every main and sub-program is charted
Lect 3 P. 17
Engineering H192 - Computer Programming
Winter Quarter
The Ohio State University
Gateway Engineering Education Coalition
Flow Charting Symbols
• The commonly used flowcharting symbols follow
• Refer to Section 9 of the H192 "Class Notes" for a
more complete description of the various
flowcharting symbols normally used
Lect 3 P. 18
Engineering H192 - Computer Programming
Winter Quarter
The Ohio State University
Gateway Engineering Education Coalition
Flow Charting Symbols
Begin or End a Procedure:
"Main Program" "Subprogram"
Begin
End
START BEGIN
STOP END
ENTER
RETURN
Lect 3 P. 19
Engineering H192 - Computer Programming
Winter Quarter
The Ohio State University
Gateway Engineering Education Coalition
Flow Charting Symbols
Write to Screen:
Read from Keyboard:
INFORM
MSG
ERROR
MSG
RESULTS
INPUT
PROMPT
INPUT
INPUT
PROMPT
OPTION
Lect 3 P. 20
Engineering H192 - Computer Programming
Winter Quarter
The Ohio State University
Gateway Engineering Education Coalition
Flow Charting Symbols
Read from a File:
Read from a File with a Check for End-of-File:
READ
EOF?
Y
N
READ
EOF?
Y
N
READ WRITE
Lect 3 P. 21
Engineering H192 - Computer Programming
Winter Quarter
The Ohio State University
Gateway Engineering Education Coalition
Flow Charting Symbols
Decision or Selection Structure:
General Processing:
QUIT?
Y
N
A<B?
F
T
process
Lect 3 P. 22
Engineering H192 - Computer Programming
Winter Quarter
The Ohio State University
Gateway Engineering Education Coalition
Flow Charting Symbols
Definite Loop:
Indefinite Loop:
y
ninit
inc
<= LIM?
do while
index <= limit
y
n
Lect 3 P. 23
Engineering H192 - Computer Programming
Winter Quarter
The Ohio State University
Gateway Engineering Education Coalition
Flow Charting Symbols
On-Page Connectors:
Off-Page Connectors:
1
2 2
1
From To
ToFrom
A
A
Lect 3 P. 24
Engineering H192 - Computer Programming
Winter Quarter
The Ohio State University
Gateway Engineering Education Coalition
Flow Charting Symbols
Call (or Invoke) a Subprogram:
subname
Lect 3 P. 25
Engineering H192 - Computer Programming
Winter Quarter
The Ohio State University
Gateway Engineering Education Coalition
Daily Assignment F2
• Problem:
There are a number of apples in a large box
which must be sorted into baskets. An apple is
either a "large red" one, a "small red" one, or a
"green" one.
• Develop a flow chart or algorithm to solve the
problem
Lect 3 P. 26
Engineering H192 - Computer Programming
Winter Quarter
The Ohio State University
Gateway Engineering Education Coalition
Daily Assignment F2
Assumptions:
1. There are 3 empty baskets present and they are
labeled:
#1 – large red, #2 – small red, #3 – green
2. There are counters of some sort present.
3. The person sorting is not color blind and can tell
the difference between large and small apples.
4. Only these three kinds of apples are in the large
box.
Lect 3 P. 27
Engineering H192 - Computer Programming
Winter Quarter
The Ohio State University
Gateway Engineering Education Coalition
Daily Assignment F2
• Are there any unknowns?
• Start with the overall problem
• Develop the steps to solve the problem

More Related Content

What's hot

Unit iii(part b - architectural design)
Unit   iii(part b - architectural design)Unit   iii(part b - architectural design)
Unit iii(part b - architectural design)BALAJI A
 
software construction modules,language,tools,design
software construction modules,language,tools,designsoftware construction modules,language,tools,design
software construction modules,language,tools,designnemali akhilesh
 
Ian Sommerville, Software Engineering, 9th Edition Ch 4
Ian Sommerville,  Software Engineering, 9th Edition Ch 4Ian Sommerville,  Software Engineering, 9th Edition Ch 4
Ian Sommerville, Software Engineering, 9th Edition Ch 4Mohammed Romi
 
Software design, software engineering
Software design, software engineeringSoftware design, software engineering
Software design, software engineeringRupesh Vaishnav
 
Lecture-1: Introduction to system integration and architecture - course overv...
Lecture-1: Introduction to system integration and architecture - course overv...Lecture-1: Introduction to system integration and architecture - course overv...
Lecture-1: Introduction to system integration and architecture - course overv...Mubashir Ali
 
Ian Sommerville, Software Engineering, 9th EditionCh 8
Ian Sommerville,  Software Engineering, 9th EditionCh 8Ian Sommerville,  Software Engineering, 9th EditionCh 8
Ian Sommerville, Software Engineering, 9th EditionCh 8Mohammed Romi
 
Computer Science A Level Specification
Computer Science A Level SpecificationComputer Science A Level Specification
Computer Science A Level SpecificationLuke Ravenscroft
 
Design concept -Software Engineering
Design concept -Software EngineeringDesign concept -Software Engineering
Design concept -Software EngineeringVarsha Ajith
 
Software Re-Engineering
Software Re-EngineeringSoftware Re-Engineering
Software Re-EngineeringSaqib Raza
 
Logic Formulation 2
Logic Formulation 2Logic Formulation 2
Logic Formulation 2deathful
 
Requirement modeling
Requirement modelingRequirement modeling
Requirement modelingAbdul Basit
 
Architectural structures and views
Architectural structures and viewsArchitectural structures and views
Architectural structures and viewsDr Reeja S R
 
Ppl for students unit 1,2 and 3
Ppl for students unit 1,2 and 3Ppl for students unit 1,2 and 3
Ppl for students unit 1,2 and 3Akshay Nagpurkar
 
estimation-for-software-projects-chapter-26-ppt.pptx
estimation-for-software-projects-chapter-26-ppt.pptxestimation-for-software-projects-chapter-26-ppt.pptx
estimation-for-software-projects-chapter-26-ppt.pptxubaidullah75790
 

What's hot (20)

Software design
Software designSoftware design
Software design
 
Unit iii(part b - architectural design)
Unit   iii(part b - architectural design)Unit   iii(part b - architectural design)
Unit iii(part b - architectural design)
 
software construction modules,language,tools,design
software construction modules,language,tools,designsoftware construction modules,language,tools,design
software construction modules,language,tools,design
 
Ian Sommerville, Software Engineering, 9th Edition Ch 4
Ian Sommerville,  Software Engineering, 9th Edition Ch 4Ian Sommerville,  Software Engineering, 9th Edition Ch 4
Ian Sommerville, Software Engineering, 9th Edition Ch 4
 
Software design, software engineering
Software design, software engineeringSoftware design, software engineering
Software design, software engineering
 
Lecture-1: Introduction to system integration and architecture - course overv...
Lecture-1: Introduction to system integration and architecture - course overv...Lecture-1: Introduction to system integration and architecture - course overv...
Lecture-1: Introduction to system integration and architecture - course overv...
 
Ian Sommerville, Software Engineering, 9th EditionCh 8
Ian Sommerville,  Software Engineering, 9th EditionCh 8Ian Sommerville,  Software Engineering, 9th EditionCh 8
Ian Sommerville, Software Engineering, 9th EditionCh 8
 
Ch19 systems engineering
Ch19 systems engineeringCh19 systems engineering
Ch19 systems engineering
 
Software design
Software designSoftware design
Software design
 
Computer Science A Level Specification
Computer Science A Level SpecificationComputer Science A Level Specification
Computer Science A Level Specification
 
Slides chapter 9
Slides chapter 9Slides chapter 9
Slides chapter 9
 
Design concept -Software Engineering
Design concept -Software EngineeringDesign concept -Software Engineering
Design concept -Software Engineering
 
COCOMO (Software Engineering)
COCOMO (Software Engineering)COCOMO (Software Engineering)
COCOMO (Software Engineering)
 
Software Re-Engineering
Software Re-EngineeringSoftware Re-Engineering
Software Re-Engineering
 
Logic Formulation 2
Logic Formulation 2Logic Formulation 2
Logic Formulation 2
 
Requirement modeling
Requirement modelingRequirement modeling
Requirement modeling
 
Architectural structures and views
Architectural structures and viewsArchitectural structures and views
Architectural structures and views
 
Ppl for students unit 1,2 and 3
Ppl for students unit 1,2 and 3Ppl for students unit 1,2 and 3
Ppl for students unit 1,2 and 3
 
estimation-for-software-projects-chapter-26-ppt.pptx
estimation-for-software-projects-chapter-26-ppt.pptxestimation-for-software-projects-chapter-26-ppt.pptx
estimation-for-software-projects-chapter-26-ppt.pptx
 
Object oriented analysis and design unit- iv
Object oriented analysis and design unit- ivObject oriented analysis and design unit- iv
Object oriented analysis and design unit- iv
 

Viewers also liked

PROGRAM LOGIC AND FORMULATION
PROGRAM LOGIC AND FORMULATIONPROGRAM LOGIC AND FORMULATION
PROGRAM LOGIC AND FORMULATIONJoland Reambillo
 
Lecture#2 Computer languages computer system and Programming EC-105
Lecture#2 Computer languages computer system and Programming EC-105Lecture#2 Computer languages computer system and Programming EC-105
Lecture#2 Computer languages computer system and Programming EC-105NUST Stuff
 
Lecture 19 matlab_script&function_files06
Lecture 19 matlab_script&function_files06Lecture 19 matlab_script&function_files06
Lecture 19 matlab_script&function_files06Aman kazmi
 
Computer programming
Computer programmingComputer programming
Computer programmingSujay Raj
 
Lab 5 array
Lab 5 arrayLab 5 array
Lab 5 arraymkazree
 
Use of computer programming in animal diet formulation
Use of computer programming in animal diet formulationUse of computer programming in animal diet formulation
Use of computer programming in animal diet formulationMilling and Grain magazine
 
Software And Computer Applications for civil engineering
Software And Computer Applications for civil engineeringSoftware And Computer Applications for civil engineering
Software And Computer Applications for civil engineeringSameer Nawab
 
Computer Engineering (Programming Language: Swift)
Computer Engineering (Programming Language: Swift)Computer Engineering (Programming Language: Swift)
Computer Engineering (Programming Language: Swift)Sethmi Kachchakaduge
 

Viewers also liked (17)

PROGRAM LOGIC AND FORMULATION
PROGRAM LOGIC AND FORMULATIONPROGRAM LOGIC AND FORMULATION
PROGRAM LOGIC AND FORMULATION
 
Lecture#2 Computer languages computer system and Programming EC-105
Lecture#2 Computer languages computer system and Programming EC-105Lecture#2 Computer languages computer system and Programming EC-105
Lecture#2 Computer languages computer system and Programming EC-105
 
C++ for beginners
C++ for beginnersC++ for beginners
C++ for beginners
 
Lecture 19 matlab_script&function_files06
Lecture 19 matlab_script&function_files06Lecture 19 matlab_script&function_files06
Lecture 19 matlab_script&function_files06
 
Computer programming
Computer programmingComputer programming
Computer programming
 
Apt programming
Apt programmingApt programming
Apt programming
 
Lab 5 array
Lab 5 arrayLab 5 array
Lab 5 array
 
Use of computer programming in animal diet formulation
Use of computer programming in animal diet formulationUse of computer programming in animal diet formulation
Use of computer programming in animal diet formulation
 
DISE - Programming Concepts
DISE - Programming ConceptsDISE - Programming Concepts
DISE - Programming Concepts
 
NC Programming
NC ProgrammingNC Programming
NC Programming
 
Computer Programming- Lecture 6
Computer Programming- Lecture 6Computer Programming- Lecture 6
Computer Programming- Lecture 6
 
10 Myths for Computer Science
10 Myths for Computer Science10 Myths for Computer Science
10 Myths for Computer Science
 
Software And Computer Applications for civil engineering
Software And Computer Applications for civil engineeringSoftware And Computer Applications for civil engineering
Software And Computer Applications for civil engineering
 
Computer Science Engineering
Computer Science EngineeringComputer Science Engineering
Computer Science Engineering
 
Computer Engineering (Programming Language: Swift)
Computer Engineering (Programming Language: Swift)Computer Engineering (Programming Language: Swift)
Computer Engineering (Programming Language: Swift)
 
Introduction to cad cam
Introduction to cad camIntroduction to cad cam
Introduction to cad cam
 
Embedded System Basics
Embedded System BasicsEmbedded System Basics
Embedded System Basics
 

Similar to Program Logic Formulation - Ohio State University

Computer programming all chapters
Computer programming all chaptersComputer programming all chapters
Computer programming all chaptersIbrahim Elewah
 
My micro project C language .pdf
My micro project C language .pdfMy micro project C language .pdf
My micro project C language .pdfBhaveshNehare
 
C programming for Computing Techniques
C programming for Computing TechniquesC programming for Computing Techniques
C programming for Computing TechniquesAppili Vamsi Krishna
 
Problem Solving Techniques and Introduction to C
Problem Solving Techniques and Introduction to CProblem Solving Techniques and Introduction to C
Problem Solving Techniques and Introduction to CPrabu U
 
Introduction to computer science
Introduction to computer scienceIntroduction to computer science
Introduction to computer scienceumardanjumamaiwada
 
data Integrative Programming untuk pemula.pdf
data Integrative Programming untuk pemula.pdfdata Integrative Programming untuk pemula.pdf
data Integrative Programming untuk pemula.pdfloliktry1
 
Lecture 1 uml with java implementation
Lecture 1 uml with java implementationLecture 1 uml with java implementation
Lecture 1 uml with java implementationthe_wumberlog
 
CIS 331 Education Redefined / snaptutorial.com
CIS 331  Education Redefined / snaptutorial.comCIS 331  Education Redefined / snaptutorial.com
CIS 331 Education Redefined / snaptutorial.comMcdonaldRyan200
 
Pj01 1-computer and programming fundamentals
Pj01 1-computer and programming fundamentalsPj01 1-computer and programming fundamentals
Pj01 1-computer and programming fundamentalsSasidharaRaoMarrapu
 
CIS110 Computer Programming Design Chapter (1)
CIS110 Computer Programming Design Chapter  (1)CIS110 Computer Programming Design Chapter  (1)
CIS110 Computer Programming Design Chapter (1)Dr. Ahmed Al Zaidy
 
chapter1-161229182113 (1).pdf
chapter1-161229182113 (1).pdfchapter1-161229182113 (1).pdf
chapter1-161229182113 (1).pdfBernardVelasco1
 

Similar to Program Logic Formulation - Ohio State University (20)

Computer programming all chapters
Computer programming all chaptersComputer programming all chapters
Computer programming all chapters
 
My micro project C language .pdf
My micro project C language .pdfMy micro project C language .pdf
My micro project C language .pdf
 
C programming for Computing Techniques
C programming for Computing TechniquesC programming for Computing Techniques
C programming for Computing Techniques
 
Programing Fundamental
Programing FundamentalPrograming Fundamental
Programing Fundamental
 
Problem Solving Techniques and Introduction to C
Problem Solving Techniques and Introduction to CProblem Solving Techniques and Introduction to C
Problem Solving Techniques and Introduction to C
 
lecture 5
 lecture 5 lecture 5
lecture 5
 
Introduction to computer science
Introduction to computer scienceIntroduction to computer science
Introduction to computer science
 
data Integrative Programming untuk pemula.pdf
data Integrative Programming untuk pemula.pdfdata Integrative Programming untuk pemula.pdf
data Integrative Programming untuk pemula.pdf
 
Session1 c1
Session1 c1Session1 c1
Session1 c1
 
Week 6
Week 6Week 6
Week 6
 
Lecture 1 uml with java implementation
Lecture 1 uml with java implementationLecture 1 uml with java implementation
Lecture 1 uml with java implementation
 
5 software design
5 software design5 software design
5 software design
 
Chap 01-1 jwfiles
Chap 01-1 jwfilesChap 01-1 jwfiles
Chap 01-1 jwfiles
 
CHAPTER 1
CHAPTER 1CHAPTER 1
CHAPTER 1
 
SE-software design.ppt
SE-software design.pptSE-software design.ppt
SE-software design.ppt
 
CIS 331 Education Redefined / snaptutorial.com
CIS 331  Education Redefined / snaptutorial.comCIS 331  Education Redefined / snaptutorial.com
CIS 331 Education Redefined / snaptutorial.com
 
Pj01 1-computer and programming fundamentals
Pj01 1-computer and programming fundamentalsPj01 1-computer and programming fundamentals
Pj01 1-computer and programming fundamentals
 
CIS110 Computer Programming Design Chapter (1)
CIS110 Computer Programming Design Chapter  (1)CIS110 Computer Programming Design Chapter  (1)
CIS110 Computer Programming Design Chapter (1)
 
chapter1-161229182113 (1).pdf
chapter1-161229182113 (1).pdfchapter1-161229182113 (1).pdf
chapter1-161229182113 (1).pdf
 
Problem solving methodology
Problem solving methodologyProblem solving methodology
Problem solving methodology
 

More from Reggie Niccolo Santos (15)

Securing PHP Applications
Securing PHP ApplicationsSecuring PHP Applications
Securing PHP Applications
 
Introduction to Web 2.0
Introduction to Web 2.0Introduction to Web 2.0
Introduction to Web 2.0
 
UI / UX Engineering for Web Applications
UI / UX Engineering for Web ApplicationsUI / UX Engineering for Web Applications
UI / UX Engineering for Web Applications
 
Computability - Tractable, Intractable and Non-computable Function
Computability - Tractable, Intractable and Non-computable FunctionComputability - Tractable, Intractable and Non-computable Function
Computability - Tractable, Intractable and Non-computable Function
 
Algorithms - Aaron Bloomfield
Algorithms - Aaron BloomfieldAlgorithms - Aaron Bloomfield
Algorithms - Aaron Bloomfield
 
Abstract Data Types
Abstract Data TypesAbstract Data Types
Abstract Data Types
 
Computational Thinking and Data Representations
Computational Thinking and Data RepresentationsComputational Thinking and Data Representations
Computational Thinking and Data Representations
 
Number Systems
Number SystemsNumber Systems
Number Systems
 
Introduction to Game Development
Introduction to Game DevelopmentIntroduction to Game Development
Introduction to Game Development
 
Application Testing
Application TestingApplication Testing
Application Testing
 
Application Security
Application SecurityApplication Security
Application Security
 
PHP MVC
PHP MVCPHP MVC
PHP MVC
 
MySQL Transactions
MySQL TransactionsMySQL Transactions
MySQL Transactions
 
MySQL Cursors
MySQL CursorsMySQL Cursors
MySQL Cursors
 
MySQL Views
MySQL ViewsMySQL Views
MySQL Views
 

Recently uploaded

renewable energy renewable energy renewable energy renewable energy
renewable energy renewable energy renewable energy  renewable energyrenewable energy renewable energy renewable energy  renewable energy
renewable energy renewable energy renewable energy renewable energyjeyasrig
 
Flutter the Future of Mobile App Development - 5 Crucial Reasons.pdf
Flutter the Future of Mobile App Development - 5 Crucial Reasons.pdfFlutter the Future of Mobile App Development - 5 Crucial Reasons.pdf
Flutter the Future of Mobile App Development - 5 Crucial Reasons.pdfMind IT Systems
 
Leveling Up your Branding and Mastering MERN: Fullstack WebDev
Leveling Up your Branding and Mastering MERN: Fullstack WebDevLeveling Up your Branding and Mastering MERN: Fullstack WebDev
Leveling Up your Branding and Mastering MERN: Fullstack WebDevpmgdscunsri
 
Splashtop Enterprise Brochure - Remote Computer Access and Remote Support Sof...
Splashtop Enterprise Brochure - Remote Computer Access and Remote Support Sof...Splashtop Enterprise Brochure - Remote Computer Access and Remote Support Sof...
Splashtop Enterprise Brochure - Remote Computer Access and Remote Support Sof...Splashtop Inc
 
8 Steps to Build a LangChain RAG Chatbot.
8 Steps to Build a LangChain RAG Chatbot.8 Steps to Build a LangChain RAG Chatbot.
8 Steps to Build a LangChain RAG Chatbot.Ritesh Kanjee
 
Large Scale Architecture -- The Unreasonable Effectiveness of Simplicity
Large Scale Architecture -- The Unreasonable Effectiveness of SimplicityLarge Scale Architecture -- The Unreasonable Effectiveness of Simplicity
Large Scale Architecture -- The Unreasonable Effectiveness of SimplicityRandy Shoup
 
Unlocking AI: Navigating Open Source vs. Commercial Frontiers
Unlocking AI:Navigating Open Source vs. Commercial FrontiersUnlocking AI:Navigating Open Source vs. Commercial Frontiers
Unlocking AI: Navigating Open Source vs. Commercial FrontiersRaphaël Semeteys
 
Mobile App Development process | Expert Tips
Mobile App Development process | Expert TipsMobile App Development process | Expert Tips
Mobile App Development process | Expert Tipsmichealwillson701
 
Einstein Copilot Conversational AI for your CRM.pdf
Einstein Copilot Conversational AI for your CRM.pdfEinstein Copilot Conversational AI for your CRM.pdf
Einstein Copilot Conversational AI for your CRM.pdfCloudMetic
 
Revolutionize Your Field Service Management with FSM Grid
Revolutionize Your Field Service Management with FSM GridRevolutionize Your Field Service Management with FSM Grid
Revolutionize Your Field Service Management with FSM GridMathew Thomas
 
Enterprise Content Managements Solutions
Enterprise Content Managements SolutionsEnterprise Content Managements Solutions
Enterprise Content Managements SolutionsIQBG inc
 
Boost Efficiency: Sabre API Integration Made Easy
Boost Efficiency: Sabre API Integration Made EasyBoost Efficiency: Sabre API Integration Made Easy
Boost Efficiency: Sabre API Integration Made Easymichealwillson701
 
Take Advantage of Mx Tracking Flight Scheduling Solutions to Streamline Your ...
Take Advantage of Mx Tracking Flight Scheduling Solutions to Streamline Your ...Take Advantage of Mx Tracking Flight Scheduling Solutions to Streamline Your ...
Take Advantage of Mx Tracking Flight Scheduling Solutions to Streamline Your ...MyFAA
 
Building Generative AI-infused apps: what's possible and how to start
Building Generative AI-infused apps: what's possible and how to startBuilding Generative AI-infused apps: what's possible and how to start
Building Generative AI-infused apps: what's possible and how to startMaxim Salnikov
 
03.2024_North America VMUG Optimizing RevOps using the power of ChatGPT in Ma...
03.2024_North America VMUG Optimizing RevOps using the power of ChatGPT in Ma...03.2024_North America VMUG Optimizing RevOps using the power of ChatGPT in Ma...
03.2024_North America VMUG Optimizing RevOps using the power of ChatGPT in Ma...jackiepotts6
 
Telebu Social -Whatsapp Business API : Mastering Omnichannel Business Communi...
Telebu Social -Whatsapp Business API : Mastering Omnichannel Business Communi...Telebu Social -Whatsapp Business API : Mastering Omnichannel Business Communi...
Telebu Social -Whatsapp Business API : Mastering Omnichannel Business Communi...telebusocialmarketin
 
CYBER SECURITY AND CYBER CRIME COMPLETE GUIDE.pLptx
CYBER SECURITY AND CYBER CRIME COMPLETE GUIDE.pLptxCYBER SECURITY AND CYBER CRIME COMPLETE GUIDE.pLptx
CYBER SECURITY AND CYBER CRIME COMPLETE GUIDE.pLptxBarakaMuyengi
 
Mobile App Development company Houston
Mobile  App  Development  company HoustonMobile  App  Development  company Houston
Mobile App Development company Houstonjennysmithusa549
 
openEuler Community Overview - a presentation showing the current scale
openEuler Community Overview - a presentation showing the current scaleopenEuler Community Overview - a presentation showing the current scale
openEuler Community Overview - a presentation showing the current scaleShane Coughlan
 

Recently uploaded (20)

renewable energy renewable energy renewable energy renewable energy
renewable energy renewable energy renewable energy  renewable energyrenewable energy renewable energy renewable energy  renewable energy
renewable energy renewable energy renewable energy renewable energy
 
Flutter the Future of Mobile App Development - 5 Crucial Reasons.pdf
Flutter the Future of Mobile App Development - 5 Crucial Reasons.pdfFlutter the Future of Mobile App Development - 5 Crucial Reasons.pdf
Flutter the Future of Mobile App Development - 5 Crucial Reasons.pdf
 
Leveling Up your Branding and Mastering MERN: Fullstack WebDev
Leveling Up your Branding and Mastering MERN: Fullstack WebDevLeveling Up your Branding and Mastering MERN: Fullstack WebDev
Leveling Up your Branding and Mastering MERN: Fullstack WebDev
 
Splashtop Enterprise Brochure - Remote Computer Access and Remote Support Sof...
Splashtop Enterprise Brochure - Remote Computer Access and Remote Support Sof...Splashtop Enterprise Brochure - Remote Computer Access and Remote Support Sof...
Splashtop Enterprise Brochure - Remote Computer Access and Remote Support Sof...
 
8 Steps to Build a LangChain RAG Chatbot.
8 Steps to Build a LangChain RAG Chatbot.8 Steps to Build a LangChain RAG Chatbot.
8 Steps to Build a LangChain RAG Chatbot.
 
Large Scale Architecture -- The Unreasonable Effectiveness of Simplicity
Large Scale Architecture -- The Unreasonable Effectiveness of SimplicityLarge Scale Architecture -- The Unreasonable Effectiveness of Simplicity
Large Scale Architecture -- The Unreasonable Effectiveness of Simplicity
 
Unlocking AI: Navigating Open Source vs. Commercial Frontiers
Unlocking AI:Navigating Open Source vs. Commercial FrontiersUnlocking AI:Navigating Open Source vs. Commercial Frontiers
Unlocking AI: Navigating Open Source vs. Commercial Frontiers
 
Mobile App Development process | Expert Tips
Mobile App Development process | Expert TipsMobile App Development process | Expert Tips
Mobile App Development process | Expert Tips
 
Einstein Copilot Conversational AI for your CRM.pdf
Einstein Copilot Conversational AI for your CRM.pdfEinstein Copilot Conversational AI for your CRM.pdf
Einstein Copilot Conversational AI for your CRM.pdf
 
Revolutionize Your Field Service Management with FSM Grid
Revolutionize Your Field Service Management with FSM GridRevolutionize Your Field Service Management with FSM Grid
Revolutionize Your Field Service Management with FSM Grid
 
Enterprise Content Managements Solutions
Enterprise Content Managements SolutionsEnterprise Content Managements Solutions
Enterprise Content Managements Solutions
 
Boost Efficiency: Sabre API Integration Made Easy
Boost Efficiency: Sabre API Integration Made EasyBoost Efficiency: Sabre API Integration Made Easy
Boost Efficiency: Sabre API Integration Made Easy
 
Take Advantage of Mx Tracking Flight Scheduling Solutions to Streamline Your ...
Take Advantage of Mx Tracking Flight Scheduling Solutions to Streamline Your ...Take Advantage of Mx Tracking Flight Scheduling Solutions to Streamline Your ...
Take Advantage of Mx Tracking Flight Scheduling Solutions to Streamline Your ...
 
Building Generative AI-infused apps: what's possible and how to start
Building Generative AI-infused apps: what's possible and how to startBuilding Generative AI-infused apps: what's possible and how to start
Building Generative AI-infused apps: what's possible and how to start
 
03.2024_North America VMUG Optimizing RevOps using the power of ChatGPT in Ma...
03.2024_North America VMUG Optimizing RevOps using the power of ChatGPT in Ma...03.2024_North America VMUG Optimizing RevOps using the power of ChatGPT in Ma...
03.2024_North America VMUG Optimizing RevOps using the power of ChatGPT in Ma...
 
Telebu Social -Whatsapp Business API : Mastering Omnichannel Business Communi...
Telebu Social -Whatsapp Business API : Mastering Omnichannel Business Communi...Telebu Social -Whatsapp Business API : Mastering Omnichannel Business Communi...
Telebu Social -Whatsapp Business API : Mastering Omnichannel Business Communi...
 
20140812 - OBD2 Solution
20140812 - OBD2 Solution20140812 - OBD2 Solution
20140812 - OBD2 Solution
 
CYBER SECURITY AND CYBER CRIME COMPLETE GUIDE.pLptx
CYBER SECURITY AND CYBER CRIME COMPLETE GUIDE.pLptxCYBER SECURITY AND CYBER CRIME COMPLETE GUIDE.pLptx
CYBER SECURITY AND CYBER CRIME COMPLETE GUIDE.pLptx
 
Mobile App Development company Houston
Mobile  App  Development  company HoustonMobile  App  Development  company Houston
Mobile App Development company Houston
 
openEuler Community Overview - a presentation showing the current scale
openEuler Community Overview - a presentation showing the current scaleopenEuler Community Overview - a presentation showing the current scale
openEuler Community Overview - a presentation showing the current scale
 

Program Logic Formulation - Ohio State University

  • 1. Lect 3 P. 1 Engineering H192 - Computer Programming Winter Quarter The Ohio State University Gateway Engineering Education Coalition Structured Engineering Problem Solving and Logic Diagrams Lecture 3
  • 2. Lect 3 P. 2 Engineering H192 - Computer Programming Winter Quarter The Ohio State University Gateway Engineering Education Coalition TOOLS FOR PROGRAM DEVELOPMENT • A variety of tools and techniques can be used in the process of program development • Useful for organizing the tasks in problem solving • Many of the tools are focused on the: – development or formulation of algorithms – representation of algorithms – refinement or structuring of algorithms
  • 3. Lect 3 P. 3 Engineering H192 - Computer Programming Winter Quarter The Ohio State University Gateway Engineering Education Coalition TOOLS FOR PROGRAM DEVELOPMENT • Top-down design technique – Start with overall function and perform several step-wise refinements • Pseudo code – Artificial and informal language that helps programmers develop algorithms • Logic diagrams – Alternate representations of algorithms including graphic and state representations
  • 4. Lect 3 P. 4 Engineering H192 - Computer Programming Winter Quarter The Ohio State University Gateway Engineering Education Coalition TOP-DOWN STEPWISE REFINEMENT • Begin with a single statement that conveys the overall function of the program. This is a complete (but simple) representation of the program. • Divide this "top" statement into a series of smaller tasks and list them in the order in which they must be performed to produce a first refinement.
  • 5. Lect 3 P. 5 Engineering H192 - Computer Programming Winter Quarter The Ohio State University Gateway Engineering Education Coalition TOP-DOWN STEPWISE REFINEMENT • Next, refine each of the smaller tasks into yet smaller steps, defining specific "variables" as may be needed in this second refinement. • Continue refinement until algorithm is fully developed. • When combined with pseudo code, writing the program is normally straightforward.
  • 6. Lect 3 P. 6 Engineering H192 - Computer Programming Winter Quarter The Ohio State University Gateway Engineering Education Coalition Top-Down Example • The Problem: The students in a class have taken their first quiz. The grades (in the range of 0 to 100) are available. Determine the class average on the quiz. • Givens: Grades, Possible range of legitimate grades.
  • 7. Lect 3 P. 7 Engineering H192 - Computer Programming Winter Quarter The Ohio State University Gateway Engineering Education Coalition Top-Down Example (continued) • Unknowns: How many grades to be averaged? • Assumptions: A "grade" not in the range of expected grades could be used to indicate the that all of the legitimate grades have been entered. (Called "sentinel" or "flag".)
  • 8. Lect 3 P. 8 Engineering H192 - Computer Programming Winter Quarter The Ohio State University Gateway Engineering Education Coalition Top-Down Example (continued) • Using pseudo code, we begin by representing the top: – Determine the class average for the quiz
  • 9. Lect 3 P. 9 Engineering H192 - Computer Programming Winter Quarter The Ohio State University Gateway Engineering Education Coalition Top-Down Example (continued) • Next, perform the first refinement: – Determine the class average for the quiz • Initialize variables • Input, sum, and count quiz grades • Calculate and print the class average
  • 10. Lect 3 P. 10 Engineering H192 - Computer Programming Winter Quarter The Ohio State University Gateway Engineering Education Coalition Top-Down Example (continued) • Next, refine each one of these smaller tasks: – Initialize variables • Initialize a running total to zero • Initialize a grade counter to zero
  • 11. Lect 3 P. 11 Engineering H192 - Computer Programming Winter Quarter The Ohio State University Gateway Engineering Education Coalition Top-Down Example (continued) Input, sum, and count quiz grades Input the first grade While the user has not entered the "flag" Add this grade into the running total Add one to the grade counter Input next grade (possibly the "flag")
  • 12. Lect 3 P. 12 Engineering H192 - Computer Programming Winter Quarter The Ohio State University Gateway Engineering Education Coalition Top-Down Example (continued) Calculate and print the class average If the grade counter is not zero Set the class average to the running total divided by the grade counter Print the average Else Print "No grades were entered"
  • 13. Lect 3 P. 13 Engineering H192 - Computer Programming Winter Quarter The Ohio State University Gateway Engineering Education Coalition Handling Special Cases • Notice that the top-down refinement example included the handling of a "special case". • Many of you are aware of the special treatment that Windows gives to the extreme "special cases" (sometimes called the BSOD or Blue Screen of Death…)
  • 14. Lect 3 P. 14 Engineering H192 - Computer Programming Winter Quarter The Ohio State University Gateway Engineering Education Coalition Handling Special Cases
  • 15. Lect 3 P. 15 Engineering H192 - Computer Programming Winter Quarter The Ohio State University Gateway Engineering Education Coalition Some Types of Logic Diagrams • Flow Charts -- graphic representation of an algorithm – an aid to writing the program – no formal standards, but common guidelines • Action Diagrams -- technique for diagramming of control structures of a program – an outline of the computer application – what things happen, when, where, how many times
  • 16. Lect 3 P. 16 Engineering H192 - Computer Programming Winter Quarter The Ohio State University Gateway Engineering Education Coalition Characteristics of Flow Charts • Useful tool in program development • Not a complete description of program • Not only tool to use • Made before writing the program • Program might differ from flowchart • Only executable statements are shown • Specific equations and tests not included • Every main and sub-program is charted
  • 17. Lect 3 P. 17 Engineering H192 - Computer Programming Winter Quarter The Ohio State University Gateway Engineering Education Coalition Flow Charting Symbols • The commonly used flowcharting symbols follow • Refer to Section 9 of the H192 "Class Notes" for a more complete description of the various flowcharting symbols normally used
  • 18. Lect 3 P. 18 Engineering H192 - Computer Programming Winter Quarter The Ohio State University Gateway Engineering Education Coalition Flow Charting Symbols Begin or End a Procedure: "Main Program" "Subprogram" Begin End START BEGIN STOP END ENTER RETURN
  • 19. Lect 3 P. 19 Engineering H192 - Computer Programming Winter Quarter The Ohio State University Gateway Engineering Education Coalition Flow Charting Symbols Write to Screen: Read from Keyboard: INFORM MSG ERROR MSG RESULTS INPUT PROMPT INPUT INPUT PROMPT OPTION
  • 20. Lect 3 P. 20 Engineering H192 - Computer Programming Winter Quarter The Ohio State University Gateway Engineering Education Coalition Flow Charting Symbols Read from a File: Read from a File with a Check for End-of-File: READ EOF? Y N READ EOF? Y N READ WRITE
  • 21. Lect 3 P. 21 Engineering H192 - Computer Programming Winter Quarter The Ohio State University Gateway Engineering Education Coalition Flow Charting Symbols Decision or Selection Structure: General Processing: QUIT? Y N A<B? F T process
  • 22. Lect 3 P. 22 Engineering H192 - Computer Programming Winter Quarter The Ohio State University Gateway Engineering Education Coalition Flow Charting Symbols Definite Loop: Indefinite Loop: y ninit inc <= LIM? do while index <= limit y n
  • 23. Lect 3 P. 23 Engineering H192 - Computer Programming Winter Quarter The Ohio State University Gateway Engineering Education Coalition Flow Charting Symbols On-Page Connectors: Off-Page Connectors: 1 2 2 1 From To ToFrom A A
  • 24. Lect 3 P. 24 Engineering H192 - Computer Programming Winter Quarter The Ohio State University Gateway Engineering Education Coalition Flow Charting Symbols Call (or Invoke) a Subprogram: subname
  • 25. Lect 3 P. 25 Engineering H192 - Computer Programming Winter Quarter The Ohio State University Gateway Engineering Education Coalition Daily Assignment F2 • Problem: There are a number of apples in a large box which must be sorted into baskets. An apple is either a "large red" one, a "small red" one, or a "green" one. • Develop a flow chart or algorithm to solve the problem
  • 26. Lect 3 P. 26 Engineering H192 - Computer Programming Winter Quarter The Ohio State University Gateway Engineering Education Coalition Daily Assignment F2 Assumptions: 1. There are 3 empty baskets present and they are labeled: #1 – large red, #2 – small red, #3 – green 2. There are counters of some sort present. 3. The person sorting is not color blind and can tell the difference between large and small apples. 4. Only these three kinds of apples are in the large box.
  • 27. Lect 3 P. 27 Engineering H192 - Computer Programming Winter Quarter The Ohio State University Gateway Engineering Education Coalition Daily Assignment F2 • Are there any unknowns? • Start with the overall problem • Develop the steps to solve the problem

Editor's Notes

  1. Narrator: Lecture 3: Structured engineering problem solving and logic diagrams.
  2. Instructor: Many design tools require the programmer to sit down and organize their thoughts in a manner which he or she understands the task to be completed. The methods provided have proved to be useful to programmers. Narrator: A variety of tools and techniques exist that can be used in the process of program development and are useful for organizing tasks in problem solving. Many of these tools are focused on the development of algorithms, representation of these algorithms, and refinement or structuring of the developed algorithms.
  3. Instructor: Not necessarily a single tool, but a combination of these tools may be used to formulate a program. Students will become familiar with all of these tools and eventually use a method of program development they are most comfortable with. Narrator: The techniques and tools we will look at are the top-down design technique, pseudo code, and logic diagrams. The technique most commonly used in program development is the top-down design technique. This technique starts with the overall function or problems and is broken down into smaller steps. Pseudo-code is a tool used to develop an algorithm, usually in an informal written language. Logic diagrams are a graphical way to represent an algorithm.
  4. Instructor: Top-down refinement is described and example given in the following slides. Narrator: First we will look in-depth at the top-down design technique. As previously stated, first begin with a single statement that conveys the overall function of the program. This is a complete, yet simple representation of the entire program. Then divide this top statement into a series of smaller tasks and list them in the order in which they must be performed. This is the first step-wise refinement.
  5. Narrator: Now take each of the smaller tasks and refine these into smaller steps as necessary. Also as it becomes apparent, define specific variables necessary to complete the steps in each task. Continue with this refinement until all tasks are broken into small tasks that can simply be programmed as computer code. Then the algorithm is fully developed. When combining this technique with pseudo-code, writing of the actual program is normally straightforward.
  6. Instructor: The following slides illustrate a top-down example where a general solution is broken down into its various tasks and variables. Narrator: Now let’s look at an example we can practice the top-down technique with. Let’s say the students in a class have taken their first quiz. The grades, which can be in the range of 0 to 100 are available. The program’s task is to determine the class average on the quiz. The givens in the problem are the grades input from the user, and the possible range of the legitimate grades.
  7. Instructor: This is one example a flag can be used. If a grade outside the range was to not be used to indicate the end of entering grades it should still be checked if it is within a valid range of responses to create fault-tolerant code. Handing this error could be responding with an error to the screen, asking the user to re-input the data, or rounding the data to a valid result. Narrator: Things that could be useful but aren’t known are the number of students in the class, and thus how many grades must be averaged. We can then assume that when a grade is not in the range of expected grades, 0 to 100, that this is an indication that all of the legitimate grades have been entered and the user wishes for the program to display the result. In programming this is called a sentinel or flag.
  8. Narrator: In pseudo-code, we can begin be developing an overall statement for the entire program, which will be the top of our top-down refinement. This top is to determine the class average for the quiz.
  9. Narrator: Now we can perform the first refinement. This refinement include three smaller steps. The first step is to initialize variables to their desired starting values. Then we input, sum, and count the quiz grades. Finally with the information input and calculated from the second step we can calculate and display the class average.
  10. Narrator: Each of these tasks can now be refined into their respective sub-tasks. We need to initialize two variables in this program, the running total of all grades, and the number of grades, or grade counter. In this case we want to initialize both variables to zero.
  11. Narrator: Refining the second step one might write pseudo code such as the code shown. We want the user to input a grade, and while the value input is not a sentinel or flag add the grade to the running total of all previous grades. Also we must increment the grade counter by 1, then ask the user to input another value. This section would continue in a loop until the user inputs a flag, or an integer not between 0 and 100.
  12. Narrator: Finally the last step covers what must be done after the users enters the flag and the answer must be calculated and displayed to the screen. Various cases may occur in this final step as shown with the if-else structure. If the grade counter is not zero, or the user has actually entered valid grades, then the class average would simply be the running total of the grades divided by the number of grades entered. This can then be printed to the screen. If the user didn’t enter any valid grades, thus entering a flag the first time prompted to enter a grade, the program could instead print and error that no grades were entered, and then exit.
  13. Instructor: It is important that students understand when programs are written they must be able to handle all special cases or “exceptions.” Exceptions are found typically in logical evaluations, mathematical expressions, or anywhere input is given by the user. The consequences of not handling all special cases in some manner results in poor performance (demonstrated by Windows’ BSOD for example). Narrator: Notice the if-else structure on the previous slide handled a special case or exception, that in which the user entered no valid grades. Exceptions are found typically in logical evaluations, mathematical expressions, or anywhere input is given by the user. The consequences of not handling all special cases in some manner results in poor performance (demonstrated by Windows’ BSOD for example).
  14. Instructor: Special cases not caught by the programmer will eventually be caught by the end-user. Thus thorough testing is necessary to ensure all possible exceptions are handled. One more recently popular method is to release public “beta” copies of software where the public itself tests the programmer’s software and is allowed to provide feedback and problems encountered. This of course can’t be done with all software developed (embedded military, nuclear reactor control, satellite applications for example). Narrator: This is one situation that, unless you are the pilot of a plane, may never expect. Thus it is important to take the mind of the user into account when creating a program or product. Special cases not caught by the programmer will eventually be caught by the end-user. Thus thorough testing is necessary to ensure all possible exceptions are handled. One more recently popular method is to release public “beta” copies of software where the public itself tests the programmer’s software and is allowed to provide feedback and problems encountered. This of course can’t be done with all software developed (such as embedded military, nuclear reactor control, or satellite applications for example).
  15. Instructor: The following slides describe flow charts and action diagrams, their similarities, differences, and applications. Narrator: Methods of organizing pseudo-code include logic diagrams. Some types of logic diagrams include flow charts and action diagrams. Flow charts are a graphical representation of an algorithm and are well suited for programmers which can visualize the flow of their programs well. It can be used as an aid to writing the actual program, and there are no formal standards, but some common guidelines exist, which will be discussed in the remainder of this lecture. Action diagrams are a more textual-based technique of diagramming the control structures of a program. The result is an outline which will closely resemble the computer application. It typically explains what things happen, when, where, and how many times. The previous pseudo-code example could be used as a basis for an action diagram.
  16. Instructor: Emphasize that the flow chart should be developed before the program is written. Narrator: Flow charts can be a useful tool in program development. They do not typically show a complete description of the program, and are typically used in conjunction with other tools. Flow charts should be made before writing the program, but can also be developed by programmers trying to understand another programmer’s code after it has been written. The final program may differ from the flowchart as only executable statements are shown in the flowchart. Specific equations and tests are also not included. When using flow charts typically every main and sub-program is charted.
  17. Instructor: Students will find in their course packets the standard flow chart diagramming symbols and should follow these guidelines when developing a flow chart. The following slides should be covered to ensure all students understand each symbol’s use. Encourage students to ask questions about these slides. Narrator: The following slides show commonly used flowcharting symbols. Please refer to your H192 class notes for these symbols and their descriptions as necessary. We will look over most of these symbols now. Be sure to ask questions about those symbols in which you are unsure of their use since you will be expected to develop a flow chart as part of today’s assignment.
  18. Narrator: The beginning and end of a program are normally shown within a rectangle with rounded corners. You may use any common text such as “start”, “begin”, or in the case of a subprogram, “enter” for example. The arrow designates the flow of the program. Normally the arrow will point to the next sequential program block in the flow chart.
  19. Instructor: The input from keyboard does not necessarily need an output to screen preceding it at all times. This is the typical way a user enters information to a program though (computer asks for input, user supplies input). When writing to the screen the shape shown here is used. Notice the text doesn’t necessarily need to be the actual text displayed to the screen, only a summary you are familiar with so that when you go back and develop your actual program you know what you wish to place here later. When reading from the keyboard the input symbol is shown below the output symbol. In this case each input from the keyboard is preceded by output to the screen prompting the user to input information. This doesn’t necessarily occur every time, but it common when inputting information from the keyboard.
  20. Instructor: The difference in order will change the program’s operation. When a read from a file occurs at some point the program should check that it is not at the end of the file (no more data to input from the file). Typically the read then check method is used more often. This will be described in more detail later when file operations are covered. Narrator: Notice the different symbol when reading and writing to a file as opposed to reading from the keyboard and writing to the screen. Also notice for a read or write the common symbol used is the same as opposed to the previous symbols. When reading from a file you may wish to check if you’ve reached the end of the file. The execution block can be used in conjunction with a selection block in either order shown depending on if you wish to check for the end of file before or after the current read. Notice in the first example if the EOF is true, the program would execute whatever block occurs on the “Y” arrow. If the answer is false, the program will follow the “N” arrow and complete a read from the file.
  21. Narrator: The EOF examples on the previous slide use the selection structure. A question is posed inside the block, and depending on if the result is true or false, or yes or no, the program may follow a different arrow and execute different code. General commands may be placed in a rectangle. This commands could be completing some mathematical equation for example.
  22. Instructor: A definite loop (for loop) completes a task a certain number of times. Init = initial condition of variable checked, inc = amount variable is incremented, LIM is the upper limit of the variable to continue in the loop in this case. An indefinite loop occurs as long as expression in the box evaluates true. Narrator: Loops can also be represented in a more complex structure which included an embedded selection block. The definite loop completes a task a certain number of times. It begins execution from the top arrow in which a variable is typically initialized to its starting value. Then while this value is less than or equal to a limit the code is executed on the “Y” branch and returns through the left arrow in which the variable is then incremented. This continues until the variable is greater than the limit, and then the “N” branch is followed. The indefinite loop completes a task for an unlimited number of times. Depending on if the logical expression in the box is true or false the loop may continue on the “Y” branch or exit via the “N” branch. This is very similar to the selection block shown on the previous slide.
  23. Instructor: In order to keep flow charts as readable as possible one should use the connectors as a last resort. When flow charts get large it may be necessary to use connectors to connect lines from various locations on the page, or to locations on other pages. These should be used as a last resort in order to keep flow charts as readable as possible.
  24. Narrator: Finally, to invoke a subprogram the symbol is shown. The subname will be the name of the subprogram which may be on the same page or more likely on a separate page.
  25. Instructor: With the assumptions given on the next slide encourage students to develop either a flowchart or action diagram using the to-down approach. Narrator: In today’s assignment you are given the problem of sorting apples in a large box into separate baskets. The apples can be classified as “large red,” “small red,” or “green.” You are to develop logic diagram for the code used to complete this task.
  26. Narrator: Some helpful assumptions you may use include the availability of three empty baskets, there are counters of some sort present, the person sorting is not color blind and can tell the difference between large and small apples already, and only three kinds of apples are in the large box that requires sorting.