SlideShare a Scribd company logo
1 of 58
Java Programming: From Problem Analysis to Program Design, 5e Chapter 5 Control Structures II: Repetition
Chapter Objectives ,[object Object],[object Object],[object Object],[object Object],Java Programming: From Problem Analysis to Program Design, 5e
Why Is Repetition Needed? ,[object Object],[object Object],[object Object],Java Programming: From Problem Analysis to Program Design, 5e
The  while  Looping (Repetition) Structure ,[object Object],[object Object],[object Object],[object Object],[object Object],Java Programming: From Problem Analysis to Program Design, 5e
The  while  Looping (Repetition) Structure (continued) Java Programming: From Problem Analysis to Program Design, 5e
The  while  Looping (Repetition) Structure (continued) ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Java Programming: From Problem Analysis to Program Design, 5e
The  while  Looping (Repetition) Structure (continued) ,[object Object],Java Programming: From Problem Analysis to Program Design, 5e
Counter-Controlled  while  Loop ,[object Object],[object Object],Java Programming: From Problem Analysis to Program Design, 5e
Java Programming: From Problem Analysis to Program Design, 5e
Java Programming: From Problem Analysis to Program Design, 5e
Java Programming: From Problem Analysis to Program Design, 5e
Java Programming: From Problem Analysis to Program Design, 5e
Sentinel-Controlled  while  Loop ,[object Object],[object Object],Java Programming: From Problem Analysis to Program Design, 5e
Java Programming: From Problem Analysis to Program Design, 5e
Java Programming: From Problem Analysis to Program Design, 5e
Flag-Controlled  while  Loop ,[object Object],[object Object],Java Programming: From Problem Analysis to Program Design, 5e
EOF (End of File)-Controlled  while  Loop ,[object Object],[object Object],[object Object],[object Object],Java Programming: From Problem Analysis to Program Design, 5e
EOF (End of File)-Controlled  while  Loop (continued) ,[object Object],[object Object],[object Object],Java Programming: From Problem Analysis to Program Design, 5e
EOF (End of File)-Controlled  while  Loop (continued) ,[object Object],Java Programming: From Problem Analysis to Program Design, 5e
Java Programming: From Problem Analysis to Program Design, 5e
Programming Example: Fibonacci Number ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Java Programming: From Problem Analysis to Program Design, 5e
Programming Example: Fibonacci Number (Solution) ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Java Programming: From Problem Analysis to Program Design, 5e
The  for  Looping (Repetition) Structure ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Java Programming: From Problem Analysis to Program Design, 5e
The  for  Looping (Repetition) Structure (continued) ,[object Object],[object Object],[object Object],[object Object],[object Object],Java Programming: From Problem Analysis to Program Design, 5e
The  for  Looping (Repetition) Structure (continued) Java Programming: From Problem Analysis to Program Design, 5e
The  for  Looping (Repetition) Structure (continued) ,[object Object],[object Object],[object Object],[object Object],[object Object],Java Programming: From Problem Analysis to Program Design, 5e
The  for  Looping (Repetition) Structure (continued) ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Java Programming: From Problem Analysis to Program Design, 5e
The  for  Looping (Repetition) Structure (continued) ,[object Object],[object Object],[object Object],[object Object],Java Programming: From Problem Analysis to Program Design, 5e
The  for  Looping (Repetition) Structure (continued) ,[object Object],[object Object],Java Programming: From Problem Analysis to Program Design, 5e
Java Programming: From Problem Analysis to Program Design, 5e
Java Programming: From Problem Analysis to Program Design, 5e
Programming Example: Classify Numbers ,[object Object],[object Object],[object Object],Java Programming: From Problem Analysis to Program Design, 5e
Programming Example: Classify Numbers (Solution) ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Java Programming: From Problem Analysis to Program Design, 5e
Programming Example: Classify Numbers (Solution) (continued) ,[object Object],Java Programming: From Problem Analysis to Program Design, 5e
The  do…while  Loop (Repetition) Structure ,[object Object],[object Object],[object Object],Java Programming: From Problem Analysis to Program Design, 5e
do…while  Loop (Post-test Loop) Java Programming: From Problem Analysis to Program Design, 5e
do…while  Loop (Post-test Loop) (continued) Java Programming: From Problem Analysis to Program Design, 5e
do…while  Loop (Post-test Loop) (continued) Java Programming: From Problem Analysis to Program Design, 5e ,[object Object],[object Object],[object Object],[object Object]
Java Programming: From Problem Analysis to Program Design, 5e Choosing the Right Looping Structure ,[object Object],[object Object],[object Object],[object Object]
break  Statements ,[object Object],[object Object],[object Object],[object Object],Java Programming: From Problem Analysis to Program Design, 5e
continue  Statements ,[object Object],[object Object],[object Object],[object Object],Java Programming: From Problem Analysis to Program Design, 5e
Java Programming: From Problem Analysis to Program Design, 5e The objective is to find the sum of the numbers in each line. For each line, output the numbers together with their sum. Let us consider the following program:
Java Programming: From Problem Analysis to Program Design, 5e
Java Programming: From Problem Analysis to Program Design, 5e
Java Programming: From Problem Analysis to Program Design, 5e
Java Programming: From Problem Analysis to Program Design, 5e ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Java Programming: From Problem Analysis to Program Design, 5e
Java Programming: From Problem Analysis to Program Design, 5e
Java Programming: From Problem Analysis to Program Design, 5e
Java Programming: From Problem Analysis to Program Design, 5e ,[object Object],[object Object],[object Object],[object Object],[object Object]
Java Programming: From Problem Analysis to Program Design, 5e ,[object Object],[object Object],[object Object]
Java Programming: From Problem Analysis to Program Design, 5e
Java Programming: From Problem Analysis to Program Design, 5e ,[object Object],[object Object],[object Object],[object Object],[object Object]
Java Programming: From Problem Analysis to Program Design, 5e ,[object Object],[object Object],[object Object]
Java Programming: From Problem Analysis to Program Design, 5e ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Nested Control Structure ,[object Object],[object Object],[object Object],Java Programming: From Problem Analysis to Program Design, 5e
Nested Control Structure (Example) ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Java Programming: From Problem Analysis to Program Design, 5e
Chapter Summary ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Java Programming: From Problem Analysis to Program Design, 5e

More Related Content

What's hot (15)

9781111530532 ppt ch07
9781111530532 ppt ch079781111530532 ppt ch07
9781111530532 ppt ch07
 
9781111530532 ppt ch08
9781111530532 ppt ch089781111530532 ppt ch08
9781111530532 ppt ch08
 
9781111530532 ppt ch04
9781111530532 ppt ch049781111530532 ppt ch04
9781111530532 ppt ch04
 
9781111530532 ppt ch02
9781111530532 ppt ch029781111530532 ppt ch02
9781111530532 ppt ch02
 
Chapter 13 - Recursion
Chapter 13 - RecursionChapter 13 - Recursion
Chapter 13 - Recursion
 
9781111530532 ppt ch06
9781111530532 ppt ch069781111530532 ppt ch06
9781111530532 ppt ch06
 
9781439035665 ppt ch04
9781439035665 ppt ch049781439035665 ppt ch04
9781439035665 ppt ch04
 
9781111530532 ppt ch09
9781111530532 ppt ch099781111530532 ppt ch09
9781111530532 ppt ch09
 
9781285852744 ppt ch14
9781285852744 ppt ch149781285852744 ppt ch14
9781285852744 ppt ch14
 
9781111530532 ppt ch07_passing_primitivetypeasobjects
9781111530532 ppt ch07_passing_primitivetypeasobjects9781111530532 ppt ch07_passing_primitivetypeasobjects
9781111530532 ppt ch07_passing_primitivetypeasobjects
 
9781439035665 ppt ch02
9781439035665 ppt ch029781439035665 ppt ch02
9781439035665 ppt ch02
 
Chap04
Chap04Chap04
Chap04
 
8 statement-level control structure
8 statement-level control structure8 statement-level control structure
8 statement-level control structure
 
(chapter 2) A Concise and Practical Introduction to Programming Algorithms in...
(chapter 2) A Concise and Practical Introduction to Programming Algorithms in...(chapter 2) A Concise and Practical Introduction to Programming Algorithms in...
(chapter 2) A Concise and Practical Introduction to Programming Algorithms in...
 
Chapter 12
Chapter 12Chapter 12
Chapter 12
 

Similar to 9781111530532 ppt ch05

9781111530532 ppt ch04
9781111530532 ppt ch049781111530532 ppt ch04
9781111530532 ppt ch04
Terry Yoast
 
9781111530532 ppt ch07_passing_primitivetypeasobjects
9781111530532 ppt ch07_passing_primitivetypeasobjects9781111530532 ppt ch07_passing_primitivetypeasobjects
9781111530532 ppt ch07_passing_primitivetypeasobjects
Terry Yoast
 
9781111530532 ppt ch02
9781111530532 ppt ch029781111530532 ppt ch02
9781111530532 ppt ch02
Terry Yoast
 
9781111530532 ppt ch07
9781111530532 ppt ch079781111530532 ppt ch07
9781111530532 ppt ch07
Terry Yoast
 
9781439035665 ppt ch07_passing_primitivetypeasobjects
9781439035665 ppt ch07_passing_primitivetypeasobjects9781439035665 ppt ch07_passing_primitivetypeasobjects
9781439035665 ppt ch07_passing_primitivetypeasobjects
Terry Yoast
 
9781111530532 ppt ch03
9781111530532 ppt ch039781111530532 ppt ch03
9781111530532 ppt ch03
Terry Yoast
 
9781439035665 ppt ch07
9781439035665 ppt ch079781439035665 ppt ch07
9781439035665 ppt ch07
Terry Yoast
 

Similar to 9781111530532 ppt ch05 (20)

9781111530532 ppt ch04
9781111530532 ppt ch049781111530532 ppt ch04
9781111530532 ppt ch04
 
9781111530532 ppt ch07_passing_primitivetypeasobjects
9781111530532 ppt ch07_passing_primitivetypeasobjects9781111530532 ppt ch07_passing_primitivetypeasobjects
9781111530532 ppt ch07_passing_primitivetypeasobjects
 
9781111530532 ppt ch02
9781111530532 ppt ch029781111530532 ppt ch02
9781111530532 ppt ch02
 
9781111530532 ppt ch07
9781111530532 ppt ch079781111530532 ppt ch07
9781111530532 ppt ch07
 
9781439035665 ppt ch07_passing_primitivetypeasobjects
9781439035665 ppt ch07_passing_primitivetypeasobjects9781439035665 ppt ch07_passing_primitivetypeasobjects
9781439035665 ppt ch07_passing_primitivetypeasobjects
 
9781111530532 ppt ch03
9781111530532 ppt ch039781111530532 ppt ch03
9781111530532 ppt ch03
 
Ppt chapter04
Ppt chapter04Ppt chapter04
Ppt chapter04
 
Pptchapter04
Pptchapter04Pptchapter04
Pptchapter04
 
Android Application Development - Level 3
Android Application Development - Level 3Android Application Development - Level 3
Android Application Development - Level 3
 
Ppt chapter06
Ppt chapter06Ppt chapter06
Ppt chapter06
 
Ase02.ppt
Ase02.pptAse02.ppt
Ase02.ppt
 
Introduction To Programming with Python Lecture 2
Introduction To Programming with Python Lecture 2Introduction To Programming with Python Lecture 2
Introduction To Programming with Python Lecture 2
 
prt123.pptx
prt123.pptxprt123.pptx
prt123.pptx
 
Control structures ii
Control structures ii Control structures ii
Control structures ii
 
9781439035665 ppt ch07
9781439035665 ppt ch079781439035665 ppt ch07
9781439035665 ppt ch07
 
22H51A6755.pptx
22H51A6755.pptx22H51A6755.pptx
22H51A6755.pptx
 
Ch05
Ch05Ch05
Ch05
 
ch5.ppt
ch5.pptch5.ppt
ch5.ppt
 
CPCS202_01_Introduction.pptx
CPCS202_01_Introduction.pptxCPCS202_01_Introduction.pptx
CPCS202_01_Introduction.pptx
 
Loops c++
Loops c++Loops c++
Loops c++
 

More from Terry Yoast

More from Terry Yoast (20)

9781305078444 ppt ch12
9781305078444 ppt ch129781305078444 ppt ch12
9781305078444 ppt ch12
 
9781305078444 ppt ch11
9781305078444 ppt ch119781305078444 ppt ch11
9781305078444 ppt ch11
 
9781305078444 ppt ch10
9781305078444 ppt ch109781305078444 ppt ch10
9781305078444 ppt ch10
 
9781305078444 ppt ch09
9781305078444 ppt ch099781305078444 ppt ch09
9781305078444 ppt ch09
 
9781305078444 ppt ch08
9781305078444 ppt ch089781305078444 ppt ch08
9781305078444 ppt ch08
 
9781305078444 ppt ch07
9781305078444 ppt ch079781305078444 ppt ch07
9781305078444 ppt ch07
 
9781305078444 ppt ch06
9781305078444 ppt ch069781305078444 ppt ch06
9781305078444 ppt ch06
 
9781305078444 ppt ch05
9781305078444 ppt ch059781305078444 ppt ch05
9781305078444 ppt ch05
 
9781305078444 ppt ch04
9781305078444 ppt ch049781305078444 ppt ch04
9781305078444 ppt ch04
 
9781305078444 ppt ch03
9781305078444 ppt ch039781305078444 ppt ch03
9781305078444 ppt ch03
 
9781305078444 ppt ch02
9781305078444 ppt ch029781305078444 ppt ch02
9781305078444 ppt ch02
 
9781305078444 ppt ch01
9781305078444 ppt ch019781305078444 ppt ch01
9781305078444 ppt ch01
 
9781337102087 ppt ch13
9781337102087 ppt ch139781337102087 ppt ch13
9781337102087 ppt ch13
 
9781337102087 ppt ch18
9781337102087 ppt ch189781337102087 ppt ch18
9781337102087 ppt ch18
 
9781337102087 ppt ch17
9781337102087 ppt ch179781337102087 ppt ch17
9781337102087 ppt ch17
 
9781337102087 ppt ch16
9781337102087 ppt ch169781337102087 ppt ch16
9781337102087 ppt ch16
 
9781337102087 ppt ch15
9781337102087 ppt ch159781337102087 ppt ch15
9781337102087 ppt ch15
 
9781337102087 ppt ch14
9781337102087 ppt ch149781337102087 ppt ch14
9781337102087 ppt ch14
 
9781337102087 ppt ch12
9781337102087 ppt ch129781337102087 ppt ch12
9781337102087 ppt ch12
 
9781337102087 ppt ch11
9781337102087 ppt ch119781337102087 ppt ch11
9781337102087 ppt ch11
 

Recently uploaded

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 

Recently uploaded (20)

Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
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
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
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, ...
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 

9781111530532 ppt ch05