tailieunhanh - Lecture An introduction to object-oriented programming with Java: Chapter 6 - C. Thomas Wu

Chapter 6 - Repetition statements. In this chapter we will cover another group of control statements called repetition statements. Repetition statements control a block of code to be executed for a fixed number of times or until a certain condition is met. We will describe Java’s three repetition statements: while, do–while, and for. | ©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Chapter 6 - Chapter 6 Repetition Statements Animated Version Introduction to OOP with Java 4th Ed, C. Thomas Wu © The McGraw-Hill Companies, Inc. Objectives After you have read and studied this chapter, you should be able to Implement repetition control in a program using while statements. Implement repetition control in a program using do-while statements. Implement a generic loop-and-a-half repetition control statement Implement repetition control in a program using for statements. Nest a loop repetition statement inside another repetition statement. Choose the appropriate repetition control statement for a given task (Optional) Write simple recursive methods Intro to OOP with Java, C. Thomas Wu ©The McGraw-Hill Companies, Inc. We will study two forms of repetition statements in this lesson. They are while and do-while statement. ©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Chapter 6 - Definition Repetition statements control a block of code to be executed for a fixed number of times or until a certain condition is met. Count-controlled repetitions terminate the execution of the block after it is executed for a fixed number of times. Sentinel-controlled repetitions terminate the execution of the block after one of the designated values called a sentinel is encountered. Repetition statements are called loop statements also. Intro to OOP with Java, C. Thomas Wu ©The McGraw-Hill Companies, Inc. In Chapter 5, we studied selection control statements. We will study in this chapter the second type of control statement, a repetition statement, that alters the sequential control flow. It controls the number of times a block of code is executed. In other words, a block of code is executed repeatedly until some condition occurs to stop the repetition. There are fundamentally two ways to stop the repetition—count-controlled and . | ©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Chapter 6 - Chapter 6 Repetition Statements Animated Version Introduction to OOP with Java 4th Ed, C. Thomas Wu © The McGraw-Hill Companies, Inc. Objectives After you have read and studied this chapter, you should be able to Implement repetition control in a program using while statements. Implement repetition control in a program using do-while statements. Implement a generic loop-and-a-half repetition control statement Implement repetition control in a program using for statements. Nest a loop repetition statement inside another repetition statement. Choose the appropriate repetition control statement for a given task (Optional) Write simple recursive methods Intro to OOP with Java, C. Thomas Wu ©The McGraw-Hill Companies, Inc. We will study two forms of repetition statements in this lesson. They are while and do-while statement. ©The McGraw-Hill Companies, Inc. Permission required for .

TÀI LIỆU MỚI ĐĂNG
15    189    0    11-05-2024
41    126    0    11-05-2024
24    112    0    11-05-2024
8    90    0    11-05-2024
44    103    0    11-05-2024
crossorigin="anonymous">
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.