Chapter 4 Control Structures: Part 1 149 Outline (Professional web hosting)

Chapter 4 Control Structures: Part 1 149 Outline 4.1 Introduction 4.2 Algorithms 4.3 Pseudocode 4.4 Control Structures 4.5 The if Selection Structure 4.6 The if/else Selection Structure 4.7 The while Repetition Structure 4.8 Formulating Algorithms: Case Study 1 (Counter-Controlled Repetition) 4.9 Formulating Algorithms with Top-Down, Stepwise Refinement: Case Study 2 (Sentinel-Controlled Repetition) 4.10 Formulating Algorithms with Top-Down, Stepwise Refinement: Case Study 3 (Nested Control Structures) 4.11 Assignment Operators 4.12 Increment and Decrement Operators 4.13 Primitive Data Types 4.14 (Optional Case Study) Thinking About Objects: Identifying Class Attributes Summary Terminology Self-Review Exercises Answers to Self-Review Exercises Exercises 4.1 Introduction Before writing a program to solve a problem, it is essential to have a thorough understanding of the problem and a carefully planned approach to solving the problem. When writing a program, it is equally essential to understand the types of building blocks that are available and to employ proven program construction principles. In this chapter and in Chapter 5, we discuss these issues in our presentation of the theory and principles of structured programming. The techniques you learn here are applicable to most high-level languages, including Java. When we study object-based programming in more depth in Chapter 8, we will see that control structures are helpful in building and manipulating objects. 4.2 Algorithms Any computing problem can be solved by executing a series of actions in a specific order. A procedure for solving a problem in terms of 1. the actions to be executed and 2. the order in which the actions are to be executed is called an algorithm. The following example demonstrates that correctly specifying the order in which the actions are to be executed is important. Copyright 1992 2002 by Deitel & Associates, Inc. All Rights Reserved. 7/2/01

Leave a Reply