tools for structured and object oriented design - do until structures
DESCRIPTION
Tools for Structured and Object Oriented Design - DO UNTIL StructuresTRANSCRIPT
![Page 1: Tools for Structured and Object Oriented Design - DO UNTIL Structures](https://reader036.vdocuments.us/reader036/viewer/2022062819/5695d3f81a28ab9b029fccc6/html5/thumbnails/1.jpg)
DO UNTIL
Tools for Structured and Object-Oriented Design
![Page 2: Tools for Structured and Object Oriented Design - DO UNTIL Structures](https://reader036.vdocuments.us/reader036/viewer/2022062819/5695d3f81a28ab9b029fccc6/html5/thumbnails/2.jpg)
Objectives
• Indentify, and use in program design, the DO UNTIL control Structure
• Distinguish between the logic of a DOWHILE pattern and the logic of a DOUNTIL pattern.
![Page 3: Tools for Structured and Object Oriented Design - DO UNTIL Structures](https://reader036.vdocuments.us/reader036/viewer/2022062819/5695d3f81a28ab9b029fccc6/html5/thumbnails/3.jpg)
Using the Do Until Loop
• When you use either a while or a for loop, the body of the loop may never execute
• When you want to ensure that a loop’s body executes at least one time, you can use a do until loop
• In a do until loop, the loop control variable is evaluated after the loop body executes
• Therefore, the body always executes at least one time
![Page 4: Tools for Structured and Object Oriented Design - DO UNTIL Structures](https://reader036.vdocuments.us/reader036/viewer/2022062819/5695d3f81a28ab9b029fccc6/html5/thumbnails/4.jpg)
do until Loop for Producing One Extra Label
![Page 5: Tools for Structured and Object Oriented Design - DO UNTIL Structures](https://reader036.vdocuments.us/reader036/viewer/2022062819/5695d3f81a28ab9b029fccc6/html5/thumbnails/5.jpg)
Printing One Label, Then Printing Enough to Cover Production
![Page 6: Tools for Structured and Object Oriented Design - DO UNTIL Structures](https://reader036.vdocuments.us/reader036/viewer/2022062819/5695d3f81a28ab9b029fccc6/html5/thumbnails/6.jpg)
Recognizing the Characteristics Shared by All Loops• All structured loops share these characteristics:
– The loop-controlling question provides either entry to or exit from the repeating structure
– The loop-controlling questions provide the only entry to or exit from the repeating structure
• You should also notice the difference between unstructured loops and the structured do until and while loops
![Page 7: Tools for Structured and Object Oriented Design - DO UNTIL Structures](https://reader036.vdocuments.us/reader036/viewer/2022062819/5695d3f81a28ab9b029fccc6/html5/thumbnails/7.jpg)
DO UNTIL Example
![Page 8: Tools for Structured and Object Oriented Design - DO UNTIL Structures](https://reader036.vdocuments.us/reader036/viewer/2022062819/5695d3f81a28ab9b029fccc6/html5/thumbnails/8.jpg)
DO UNTIL Example
![Page 9: Tools for Structured and Object Oriented Design - DO UNTIL Structures](https://reader036.vdocuments.us/reader036/viewer/2022062819/5695d3f81a28ab9b029fccc6/html5/thumbnails/9.jpg)
DO UNTIL ExamplePseudocode
![Page 10: Tools for Structured and Object Oriented Design - DO UNTIL Structures](https://reader036.vdocuments.us/reader036/viewer/2022062819/5695d3f81a28ab9b029fccc6/html5/thumbnails/10.jpg)
DO UNTIL Example
![Page 11: Tools for Structured and Object Oriented Design - DO UNTIL Structures](https://reader036.vdocuments.us/reader036/viewer/2022062819/5695d3f81a28ab9b029fccc6/html5/thumbnails/11.jpg)
DO UNTIL Example
![Page 12: Tools for Structured and Object Oriented Design - DO UNTIL Structures](https://reader036.vdocuments.us/reader036/viewer/2022062819/5695d3f81a28ab9b029fccc6/html5/thumbnails/12.jpg)
DO UNTIL Examples
![Page 13: Tools for Structured and Object Oriented Design - DO UNTIL Structures](https://reader036.vdocuments.us/reader036/viewer/2022062819/5695d3f81a28ab9b029fccc6/html5/thumbnails/13.jpg)
DOWHILE vs. DOUNTIL
![Page 14: Tools for Structured and Object Oriented Design - DO UNTIL Structures](https://reader036.vdocuments.us/reader036/viewer/2022062819/5695d3f81a28ab9b029fccc6/html5/thumbnails/14.jpg)
DOWHILE vs. DOUNTIL