# OODP101_Week4.pptx - Object Oriented Design and Programming...

• No School
• AA 1
• 33

This preview shows page 1 - 9 out of 33 pages.

The preview shows page 7 - 9 out of 33 pages.
Object Oriented Design and ProgrammingWeek 4A B Emran Salahuddin (Sydney)Manzur Ashraf (Melbourne)Kent Institute Australia Pty. Ltd.ABN 49 003 577 302 CRICOS Code: 00161ERTO Code: 90458 TEQSA Provider Number: PRV12051Version 2 – 18thDecember 2015
SLIDE TITLEFarrell, J. (2017) Programming Logic and Design, Comprehensive (9th ed.) Cengage Learning 2
Programming Logic and DesignNinth EditionChapter 5Understanding Programming Structures3Programming Logic and Design, Ninth Edition
ObjectivesProgramming Structure-LoopingWhile loopDo-while loopFor loopCombination of programming structuresUnderstanding the Reasons for Structure4Programming Logic and Design, Ninth Edition
The Loop StructureLoop structureRepeats a set of actions while a condition remains trueLoop bodyAlso called repetitionor iterationCondition is tested first in the most common form of loopThe while…door whileloop or for loop5Programming Logic and Design, Ninth Edition
The Loop Structure (continued -2)Loop structurewhiletestCondition continues to be truedosomeProcess endwhilewhileyou continue to be hungrytake another bite of fooddetermine if you still feel hungryendwhile6Programming Logic and Design, Ninth Edition
The Loop Structure (continued -3)while loopAsk a question and, depending on the answer, you might or might not enter the loop to execute the loop’s procedure.A while loop is also called a pretest loop because a condition is tested before entering the loop even once. 7Programming Logic and Design, Ninth Edition
The Loop Structure (continued -4)while loopThe important point to note when using while loop: Use increment or decrement statement inside while loop Loop variable gets changed on each iterationAnd at some point condition returns falseThis way we can end the execution of while loop otherwise the loop would execute indefinitely.

Course Hero member to access this document

Course Hero member to access this document

End of preview. Want to read all 33 pages?