SlideShare une entreprise Scribd logo
1  sur  19
RECOGNIZING
STRUCTURES
Recognizing Structures
 When you are beginning to learn about
structured program design, it is difficult to
detect whether a flowchart of a program’s logic
is structured.
 In recognizing structure, the three basic
structures must be taken into consideration.
 By recognizing its structure we can identify if
there are tangled or unstructured flowchart
segments.
Example 1:
 Does the flowchart
segment
structured?
 How many
structures does
the flowchart
segment have?
 What structures do
you recognize
from the flowchart
segment?
Sequence
Selection
Figure 1
Example 2:
 Does the flowchart
segment
structured?
 How many
structures does
the flowchart
segment have?
 What structures do
you recognize
from the flowchart
segment?
Loop
Selection
Figure 2
Example 3:
 Does the
flowchart
segment
structured?
 No, it is not built
from the three
basic structures.
Figure 3
This part of
the segment
is not
structured
Spaghetti Bowl Method
 One way to straighten out an unstructured
flowchart segment is to use the “spaghetti
bowl” method.
 That is, picture the flowchart as a bowl of
spaghetti that you must untangle. Imagine you
can grab one piece of pasta at the top of the
bowl and start pulling. As you “pull” each
symbol out of the tangled mess, you can
untangle the separate paths until the entire
segment is structured.
Spaghetti Bowl Method (cont’d.)
 Use the Spaghetti Bowl Method to structure
the flowchart segment
 Start pulling at Figure 3 top
 Encounter procedure box Labeled A (Figure 3-1)
Figure 3-1 Untangling Example 3, first step
Spaghetti Bowl Method (cont’d.)
 Next item is a question
 Testing condition labeled B (Figure 3-2)
 Now know sequence starting with A ended
Figure 3-2 Untangling Example 3, second step
Spaghetti Bowl Method (cont’d.)
 Pull flowline from “No” side of Question B
 Encounter C (Figure 3-3)
Figure 3-3 Untangling Example 3, third step
Spaghetti Bowl Method (cont’d.)
 Pull flowline from “Yes” side of Question B
 Encounter D (Figure 3-4)
Figure 3-4 Untangling Example 3, fourth step
Spaghetti Bowl Method (cont’d.)
 Follow line on left side of Question D
 If line attached somewhere, untangle by repeating
tangled step
 Continue pulling flowline emerging from Step
C
 Reach end of program segment (Figure 3-5)
Figure 3-5 Untangling Example 3, fifth step
Spaghetti Bowl Method (cont’d.)
 Pull right side of Question D
 Process E pops up (Figure 2-6)
 Reached the end
Figure 2-6 Untangling Example 3, sixth step
Spaghetti Bowl Method (cont’d.)
 Question D brought together: selection
structure
 Question B loose ends brought together:
selection structure
Figure 3 Finished flowchart and
pseudo code for untangling
Example 3
Describing Three Special
Structures –
Case, While and Do-Until
 Three more forms of basic structures
 Case
 Alternative decision-making structure
 Do-while
 Alternative to while loop
 Do-until loops
 Alternative to while loop
 Sometimes convenient
 All acceptable, legal structures
The Case Structure
 Several possible values exists for single
variable being tested
 Each value requires different course of action
 Flow passes through only one alternative
 Flowchart, pseudo code, program code
convenience
 Easier to understand at first glance
 Examples
 Figure 4-1: series of decisions
 Figure 4-2: case structure implementing decisions
The Case Structure (cont’d.)
Figure 4-1 Flowchart and pseudo code of tuition
decisions
The Case Structure (cont’d.)
Figure 4-2 Flowchart
and pseudo code of
case structure
The While Loop
 while loop
 Condition tested at structure beginning
 Condition not met at first test
 Code in while structure body never executed
 Also called a pretest loop
Figure 4-3 The while loop
The Do-While or Do-Until Loops
 do-while loop
 Condition tested at structure end
 Body has executed at least once
 Expressed as a sequence followed by a loop
 Also called a posttest loop
Figure 4-4 The do-while or do-until loop

Contenu connexe

Plus de MattFlordeliza1

JDBC OVERVIEW uses from the subject of EDP.pptx
JDBC OVERVIEW uses from the subject of EDP.pptxJDBC OVERVIEW uses from the subject of EDP.pptx
JDBC OVERVIEW uses from the subject of EDP.pptxMattFlordeliza1
 
ACtionlistener in java use in discussion.pptx
ACtionlistener in java use in discussion.pptxACtionlistener in java use in discussion.pptx
ACtionlistener in java use in discussion.pptxMattFlordeliza1
 
PLF-Lesson tsu lecture time 2 units-2.pptx
PLF-Lesson tsu lecture time 2 units-2.pptxPLF-Lesson tsu lecture time 2 units-2.pptx
PLF-Lesson tsu lecture time 2 units-2.pptxMattFlordeliza1
 
Psuedocode1, algorithm1, Flowchart1.pptx
Psuedocode1, algorithm1, Flowchart1.pptxPsuedocode1, algorithm1, Flowchart1.pptx
Psuedocode1, algorithm1, Flowchart1.pptxMattFlordeliza1
 

Plus de MattFlordeliza1 (6)

JDBC OVERVIEW uses from the subject of EDP.pptx
JDBC OVERVIEW uses from the subject of EDP.pptxJDBC OVERVIEW uses from the subject of EDP.pptx
JDBC OVERVIEW uses from the subject of EDP.pptx
 
ACtionlistener in java use in discussion.pptx
ACtionlistener in java use in discussion.pptxACtionlistener in java use in discussion.pptx
ACtionlistener in java use in discussion.pptx
 
PLF-Lesson tsu lecture time 2 units-2.pptx
PLF-Lesson tsu lecture time 2 units-2.pptxPLF-Lesson tsu lecture time 2 units-2.pptx
PLF-Lesson tsu lecture time 2 units-2.pptx
 
Psuedocode1, algorithm1, Flowchart1.pptx
Psuedocode1, algorithm1, Flowchart1.pptxPsuedocode1, algorithm1, Flowchart1.pptx
Psuedocode1, algorithm1, Flowchart1.pptx
 
www module 1.pptx
www module 1.pptxwww module 1.pptx
www module 1.pptx
 
QUEUE.pptx
QUEUE.pptxQUEUE.pptx
QUEUE.pptx
 

Dernier

Russian Call Girls in Kolkata Ishita 🤌 8250192130 🚀 Vip Call Girls Kolkata
Russian Call Girls in Kolkata Ishita 🤌  8250192130 🚀 Vip Call Girls KolkataRussian Call Girls in Kolkata Ishita 🤌  8250192130 🚀 Vip Call Girls Kolkata
Russian Call Girls in Kolkata Ishita 🤌 8250192130 🚀 Vip Call Girls Kolkataanamikaraghav4
 
VIP Kolkata Call Girl Salt Lake 👉 8250192130 Available With Room
VIP Kolkata Call Girl Salt Lake 👉 8250192130  Available With RoomVIP Kolkata Call Girl Salt Lake 👉 8250192130  Available With Room
VIP Kolkata Call Girl Salt Lake 👉 8250192130 Available With Roomishabajaj13
 
VIP 7001035870 Find & Meet Hyderabad Call Girls Dilsukhnagar high-profile Cal...
VIP 7001035870 Find & Meet Hyderabad Call Girls Dilsukhnagar high-profile Cal...VIP 7001035870 Find & Meet Hyderabad Call Girls Dilsukhnagar high-profile Cal...
VIP 7001035870 Find & Meet Hyderabad Call Girls Dilsukhnagar high-profile Cal...aditipandeya
 
Call Girls in Uttam Nagar Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Uttam Nagar Delhi 💯Call Us 🔝8264348440🔝Call Girls in Uttam Nagar Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Uttam Nagar Delhi 💯Call Us 🔝8264348440🔝soniya singh
 
VIP Kolkata Call Girl Alambazar 👉 8250192130 Available With Room
VIP Kolkata Call Girl Alambazar 👉 8250192130  Available With RoomVIP Kolkata Call Girl Alambazar 👉 8250192130  Available With Room
VIP Kolkata Call Girl Alambazar 👉 8250192130 Available With Roomdivyansh0kumar0
 
Git and Github workshop GDSC MLRITM
Git and Github  workshop GDSC MLRITMGit and Github  workshop GDSC MLRITM
Git and Github workshop GDSC MLRITMgdsc13
 
定制(Lincoln毕业证书)新西兰林肯大学毕业证成绩单原版一比一
定制(Lincoln毕业证书)新西兰林肯大学毕业证成绩单原版一比一定制(Lincoln毕业证书)新西兰林肯大学毕业证成绩单原版一比一
定制(Lincoln毕业证书)新西兰林肯大学毕业证成绩单原版一比一Fs
 
Russian Call Girls in Kolkata Samaira 🤌 8250192130 🚀 Vip Call Girls Kolkata
Russian Call Girls in Kolkata Samaira 🤌  8250192130 🚀 Vip Call Girls KolkataRussian Call Girls in Kolkata Samaira 🤌  8250192130 🚀 Vip Call Girls Kolkata
Russian Call Girls in Kolkata Samaira 🤌 8250192130 🚀 Vip Call Girls Kolkataanamikaraghav4
 
AlbaniaDreamin24 - How to easily use an API with Flows
AlbaniaDreamin24 - How to easily use an API with FlowsAlbaniaDreamin24 - How to easily use an API with Flows
AlbaniaDreamin24 - How to easily use an API with FlowsThierry TROUIN ☁
 
How is AI changing journalism? (v. April 2024)
How is AI changing journalism? (v. April 2024)How is AI changing journalism? (v. April 2024)
How is AI changing journalism? (v. April 2024)Damian Radcliffe
 
定制(Management毕业证书)新加坡管理大学毕业证成绩单原版一比一
定制(Management毕业证书)新加坡管理大学毕业证成绩单原版一比一定制(Management毕业证书)新加坡管理大学毕业证成绩单原版一比一
定制(Management毕业证书)新加坡管理大学毕业证成绩单原版一比一Fs
 
定制(AUT毕业证书)新西兰奥克兰理工大学毕业证成绩单原版一比一
定制(AUT毕业证书)新西兰奥克兰理工大学毕业证成绩单原版一比一定制(AUT毕业证书)新西兰奥克兰理工大学毕业证成绩单原版一比一
定制(AUT毕业证书)新西兰奥克兰理工大学毕业证成绩单原版一比一Fs
 
Packaging the Monolith - PHP Tek 2024 (Breaking it down one bite at a time)
Packaging the Monolith - PHP Tek 2024 (Breaking it down one bite at a time)Packaging the Monolith - PHP Tek 2024 (Breaking it down one bite at a time)
Packaging the Monolith - PHP Tek 2024 (Breaking it down one bite at a time)Dana Luther
 
Call Girls In Mumbai Central Mumbai ❤️ 9920874524 👈 Cash on Delivery
Call Girls In Mumbai Central Mumbai ❤️ 9920874524 👈 Cash on DeliveryCall Girls In Mumbai Central Mumbai ❤️ 9920874524 👈 Cash on Delivery
Call Girls In Mumbai Central Mumbai ❤️ 9920874524 👈 Cash on Deliverybabeytanya
 
Chennai Call Girls Porur Phone 🍆 8250192130 👅 celebrity escorts service
Chennai Call Girls Porur Phone 🍆 8250192130 👅 celebrity escorts serviceChennai Call Girls Porur Phone 🍆 8250192130 👅 celebrity escorts service
Chennai Call Girls Porur Phone 🍆 8250192130 👅 celebrity escorts servicesonalikaur4
 
Russian Call girls in Dubai +971563133746 Dubai Call girls
Russian  Call girls in Dubai +971563133746 Dubai  Call girlsRussian  Call girls in Dubai +971563133746 Dubai  Call girls
Russian Call girls in Dubai +971563133746 Dubai Call girlsstephieert
 

Dernier (20)

Russian Call Girls in Kolkata Ishita 🤌 8250192130 🚀 Vip Call Girls Kolkata
Russian Call Girls in Kolkata Ishita 🤌  8250192130 🚀 Vip Call Girls KolkataRussian Call Girls in Kolkata Ishita 🤌  8250192130 🚀 Vip Call Girls Kolkata
Russian Call Girls in Kolkata Ishita 🤌 8250192130 🚀 Vip Call Girls Kolkata
 
VIP Kolkata Call Girl Salt Lake 👉 8250192130 Available With Room
VIP Kolkata Call Girl Salt Lake 👉 8250192130  Available With RoomVIP Kolkata Call Girl Salt Lake 👉 8250192130  Available With Room
VIP Kolkata Call Girl Salt Lake 👉 8250192130 Available With Room
 
VIP 7001035870 Find & Meet Hyderabad Call Girls Dilsukhnagar high-profile Cal...
VIP 7001035870 Find & Meet Hyderabad Call Girls Dilsukhnagar high-profile Cal...VIP 7001035870 Find & Meet Hyderabad Call Girls Dilsukhnagar high-profile Cal...
VIP 7001035870 Find & Meet Hyderabad Call Girls Dilsukhnagar high-profile Cal...
 
Rohini Sector 26 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
Rohini Sector 26 Call Girls Delhi 9999965857 @Sabina Saikh No AdvanceRohini Sector 26 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
Rohini Sector 26 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
 
Call Girls in Uttam Nagar Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Uttam Nagar Delhi 💯Call Us 🔝8264348440🔝Call Girls in Uttam Nagar Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Uttam Nagar Delhi 💯Call Us 🔝8264348440🔝
 
VIP Kolkata Call Girl Alambazar 👉 8250192130 Available With Room
VIP Kolkata Call Girl Alambazar 👉 8250192130  Available With RoomVIP Kolkata Call Girl Alambazar 👉 8250192130  Available With Room
VIP Kolkata Call Girl Alambazar 👉 8250192130 Available With Room
 
sasti delhi Call Girls in munirka 🔝 9953056974 🔝 escort Service-
sasti delhi Call Girls in munirka 🔝 9953056974 🔝 escort Service-sasti delhi Call Girls in munirka 🔝 9953056974 🔝 escort Service-
sasti delhi Call Girls in munirka 🔝 9953056974 🔝 escort Service-
 
Git and Github workshop GDSC MLRITM
Git and Github  workshop GDSC MLRITMGit and Github  workshop GDSC MLRITM
Git and Github workshop GDSC MLRITM
 
定制(Lincoln毕业证书)新西兰林肯大学毕业证成绩单原版一比一
定制(Lincoln毕业证书)新西兰林肯大学毕业证成绩单原版一比一定制(Lincoln毕业证书)新西兰林肯大学毕业证成绩单原版一比一
定制(Lincoln毕业证书)新西兰林肯大学毕业证成绩单原版一比一
 
Call Girls Service Dwarka @9999965857 Delhi 🫦 No Advance VVIP 🍎 SERVICE
Call Girls Service Dwarka @9999965857 Delhi 🫦 No Advance  VVIP 🍎 SERVICECall Girls Service Dwarka @9999965857 Delhi 🫦 No Advance  VVIP 🍎 SERVICE
Call Girls Service Dwarka @9999965857 Delhi 🫦 No Advance VVIP 🍎 SERVICE
 
Russian Call Girls in Kolkata Samaira 🤌 8250192130 🚀 Vip Call Girls Kolkata
Russian Call Girls in Kolkata Samaira 🤌  8250192130 🚀 Vip Call Girls KolkataRussian Call Girls in Kolkata Samaira 🤌  8250192130 🚀 Vip Call Girls Kolkata
Russian Call Girls in Kolkata Samaira 🤌 8250192130 🚀 Vip Call Girls Kolkata
 
AlbaniaDreamin24 - How to easily use an API with Flows
AlbaniaDreamin24 - How to easily use an API with FlowsAlbaniaDreamin24 - How to easily use an API with Flows
AlbaniaDreamin24 - How to easily use an API with Flows
 
How is AI changing journalism? (v. April 2024)
How is AI changing journalism? (v. April 2024)How is AI changing journalism? (v. April 2024)
How is AI changing journalism? (v. April 2024)
 
young call girls in Uttam Nagar🔝 9953056974 🔝 Delhi escort Service
young call girls in Uttam Nagar🔝 9953056974 🔝 Delhi escort Serviceyoung call girls in Uttam Nagar🔝 9953056974 🔝 Delhi escort Service
young call girls in Uttam Nagar🔝 9953056974 🔝 Delhi escort Service
 
定制(Management毕业证书)新加坡管理大学毕业证成绩单原版一比一
定制(Management毕业证书)新加坡管理大学毕业证成绩单原版一比一定制(Management毕业证书)新加坡管理大学毕业证成绩单原版一比一
定制(Management毕业证书)新加坡管理大学毕业证成绩单原版一比一
 
定制(AUT毕业证书)新西兰奥克兰理工大学毕业证成绩单原版一比一
定制(AUT毕业证书)新西兰奥克兰理工大学毕业证成绩单原版一比一定制(AUT毕业证书)新西兰奥克兰理工大学毕业证成绩单原版一比一
定制(AUT毕业证书)新西兰奥克兰理工大学毕业证成绩单原版一比一
 
Packaging the Monolith - PHP Tek 2024 (Breaking it down one bite at a time)
Packaging the Monolith - PHP Tek 2024 (Breaking it down one bite at a time)Packaging the Monolith - PHP Tek 2024 (Breaking it down one bite at a time)
Packaging the Monolith - PHP Tek 2024 (Breaking it down one bite at a time)
 
Call Girls In Mumbai Central Mumbai ❤️ 9920874524 👈 Cash on Delivery
Call Girls In Mumbai Central Mumbai ❤️ 9920874524 👈 Cash on DeliveryCall Girls In Mumbai Central Mumbai ❤️ 9920874524 👈 Cash on Delivery
Call Girls In Mumbai Central Mumbai ❤️ 9920874524 👈 Cash on Delivery
 
Chennai Call Girls Porur Phone 🍆 8250192130 👅 celebrity escorts service
Chennai Call Girls Porur Phone 🍆 8250192130 👅 celebrity escorts serviceChennai Call Girls Porur Phone 🍆 8250192130 👅 celebrity escorts service
Chennai Call Girls Porur Phone 🍆 8250192130 👅 celebrity escorts service
 
Russian Call girls in Dubai +971563133746 Dubai Call girls
Russian  Call girls in Dubai +971563133746 Dubai  Call girlsRussian  Call girls in Dubai +971563133746 Dubai  Call girls
Russian Call girls in Dubai +971563133746 Dubai Call girls
 

PLF-Lesson-5 programming in TSU lec.pptx

  • 2. Recognizing Structures  When you are beginning to learn about structured program design, it is difficult to detect whether a flowchart of a program’s logic is structured.  In recognizing structure, the three basic structures must be taken into consideration.  By recognizing its structure we can identify if there are tangled or unstructured flowchart segments.
  • 3. Example 1:  Does the flowchart segment structured?  How many structures does the flowchart segment have?  What structures do you recognize from the flowchart segment? Sequence Selection Figure 1
  • 4. Example 2:  Does the flowchart segment structured?  How many structures does the flowchart segment have?  What structures do you recognize from the flowchart segment? Loop Selection Figure 2
  • 5. Example 3:  Does the flowchart segment structured?  No, it is not built from the three basic structures. Figure 3 This part of the segment is not structured
  • 6. Spaghetti Bowl Method  One way to straighten out an unstructured flowchart segment is to use the “spaghetti bowl” method.  That is, picture the flowchart as a bowl of spaghetti that you must untangle. Imagine you can grab one piece of pasta at the top of the bowl and start pulling. As you “pull” each symbol out of the tangled mess, you can untangle the separate paths until the entire segment is structured.
  • 7. Spaghetti Bowl Method (cont’d.)  Use the Spaghetti Bowl Method to structure the flowchart segment  Start pulling at Figure 3 top  Encounter procedure box Labeled A (Figure 3-1) Figure 3-1 Untangling Example 3, first step
  • 8. Spaghetti Bowl Method (cont’d.)  Next item is a question  Testing condition labeled B (Figure 3-2)  Now know sequence starting with A ended Figure 3-2 Untangling Example 3, second step
  • 9. Spaghetti Bowl Method (cont’d.)  Pull flowline from “No” side of Question B  Encounter C (Figure 3-3) Figure 3-3 Untangling Example 3, third step
  • 10. Spaghetti Bowl Method (cont’d.)  Pull flowline from “Yes” side of Question B  Encounter D (Figure 3-4) Figure 3-4 Untangling Example 3, fourth step
  • 11. Spaghetti Bowl Method (cont’d.)  Follow line on left side of Question D  If line attached somewhere, untangle by repeating tangled step  Continue pulling flowline emerging from Step C  Reach end of program segment (Figure 3-5) Figure 3-5 Untangling Example 3, fifth step
  • 12. Spaghetti Bowl Method (cont’d.)  Pull right side of Question D  Process E pops up (Figure 2-6)  Reached the end Figure 2-6 Untangling Example 3, sixth step
  • 13. Spaghetti Bowl Method (cont’d.)  Question D brought together: selection structure  Question B loose ends brought together: selection structure Figure 3 Finished flowchart and pseudo code for untangling Example 3
  • 14. Describing Three Special Structures – Case, While and Do-Until  Three more forms of basic structures  Case  Alternative decision-making structure  Do-while  Alternative to while loop  Do-until loops  Alternative to while loop  Sometimes convenient  All acceptable, legal structures
  • 15. The Case Structure  Several possible values exists for single variable being tested  Each value requires different course of action  Flow passes through only one alternative  Flowchart, pseudo code, program code convenience  Easier to understand at first glance  Examples  Figure 4-1: series of decisions  Figure 4-2: case structure implementing decisions
  • 16. The Case Structure (cont’d.) Figure 4-1 Flowchart and pseudo code of tuition decisions
  • 17. The Case Structure (cont’d.) Figure 4-2 Flowchart and pseudo code of case structure
  • 18. The While Loop  while loop  Condition tested at structure beginning  Condition not met at first test  Code in while structure body never executed  Also called a pretest loop Figure 4-3 The while loop
  • 19. The Do-While or Do-Until Loops  do-while loop  Condition tested at structure end  Body has executed at least once  Expressed as a sequence followed by a loop  Also called a posttest loop Figure 4-4 The do-while or do-until loop

Notes de l'éditeur

  1. Yes it is structured.. 2 structures Sequence and Selection NOTE: notice that the segment has only one entry point and exit point.
  2. Yes it is structured.. 2 structures Loop and a Selection within the Loop NOTE: notice that the segment has only one entry point and exit point.