Just Enough Programming Logic and Design

This document was uploaded by one of our users. The uploader already confirmed that they had the permission to publish it. If you are author/publisher or own the copyright of this documents, please report to us by using this DMCA report form.

Simply click on the Download Book button.

Yes, Book downloads on Ebookily are 100% Free.

Sometimes the book is free on Amazon As well, so go ahead and hit "Search on Amazon"

Author(s): Joyce Farrell
Publisher: Course Technology
Year: 2009

Language: English
Pages: 256

Front Cover......Page 1
Title Page......Page 4
Copyright
......Page 5
Contents......Page 7
Preface......Page 11
CHAPTER 1 An Overview of Computers and Logic......Page 14
Understanding Computer Components and Operations......Page 15
Understanding the Problem......Page 19
Planning the Logic......Page 20
Using Software to Translate the Program into Machine Language......Page 21
Testing the Program......Page 22
Using Pseudocode Statements and Flowchart Symbols......Page 24
The Advantages of Repetition......Page 27
Using and Naming Variables and Constants......Page 29
Assigning Values to Variables......Page 30
Understanding Data Types and Declaring Variables......Page 32
Ending a Program by Using Sentinel Values......Page 34
Understanding the Evolution of Programming Techniques......Page 37
Review Questions......Page 38
Exercises......Page 40
CHAPTER 2 Understanding Structure......Page 44
Understanding Unstructured Spaghetti Code......Page 45
Understanding the Three Basic Structures: Sequence, Selection, and Loop......Page 47
Using the Priming Input......Page 55
Recognizing Structure and Structuring Unstructured Logic......Page 62
Structuring the Dog- Washing Process......Page 67
Review Questions......Page 71
Find the Bugs......Page 73
Exercises......Page 74
CHAPTER 3 Making Decisions......Page 78
Evaluating Boolean Expressions to Make Comparisons......Page 79
Using the Relational Comparison Operators......Page 83
Understanding AND Logic......Page 85
Nesting and Decisions for Efficiency......Page 87
Combining Decisions Using the AND Operator......Page 90
Avoiding Common Errors in an AND Selection......Page 92
Understanding OR Logic......Page 95
Writing OR Decisions for Efficiency......Page 97
Combining Decisions in an OR Selection......Page 98
Avoiding Common Errors in an OR Selection......Page 100
Making Selections Within Ranges......Page 104
Avoiding Common Errors When Using Range Checks......Page 106
Understanding Precedence When Combining AND and OR Operators......Page 110
Review Questions......Page 112
Find the Bugs......Page 115
Exercises......Page 116
CHAPTER 4 Looping......Page 122
Controlling Loops with Counters and Sentinel Values......Page 123
Using a Definite while Loop with a Counter......Page 124
Using an Indefinite while Loop with a Sentinel Value......Page 126
Nested Loops......Page 130
Mixing Constant and Variable Sentinel Values......Page 132
Mistake: Neglecting to Initialize the Loop Control Variable......Page 136
Mistake: Neglecting to Alter the Loop Control Variable......Page 138
Mistake: Including Statements Inside the Loop that Belong Outside the Loop......Page 140
Using a for Loop......Page 142
Using a Loop to Accumulate Totals......Page 144
Using a Loop to Validate Data......Page 146
Review Questions......Page 148
Exercises......Page 151
CHAPTER 5 Arrays......Page 155
How Arrays Occupy Computer Memory......Page 156
Manipulating an Array to Replace Nested Decisions......Page 158
Searching an Array Using a while Loop......Page 166
Using Parallel Arrays......Page 169
Improving Search Efficiency......Page 173
Remaining Within Array Bounds......Page 174
Using a for Loop to Process Arrays......Page 176
Review Questions......Page 177
Exercises......Page 179
CHAPTER 6 Using Methods......Page 184
Modularization Provides Abstraction and Eliminates Repetition......Page 185
Modularization Allows Multiple Programmers to Work on a Problem......Page 186
Creating a Method......Page 187
Modularizing Program Logic to Avoid Unnecessary Repetition......Page 188
Modularizing a Program for Functional Cohesion and Portability......Page 193
Understanding Scope......Page 196
Creating Methods That Require a Single Parameter......Page 199
Creating Methods That Require Multiple Parameters......Page 203
Creating Methods That Return Values......Page 204
Understanding Implementation Hiding......Page 209
Using Prewritten Built-In Methods......Page 210
Review Questions......Page 211
Exercises......Page 214
CHAPTER 7 Object-Oriented Programming......Page 217
An Overview of Some Principles of Object-Oriented Programming......Page 218
Defining a Class......Page 219
Instantiating an Object......Page 221
Understanding Public and Private Access......Page 223
Understanding Inheritance......Page 226
Understanding Polymorphism......Page 227
Understanding Encapsulation......Page 228
Advantages of Object-Oriented Programming......Page 230
Review Questions......Page 231
Find the Bugs......Page 233
Exercises......Page 234
APPENDIX A: Understanding Numbering Systems and Computer Codes......Page 237
APPENDIX B: Two Special Structures—case and do-while......Page 242
Index......Page 248