| |
| |
Preface | |
| |
| |
Acknowledgments | |
| |
| |
About the Author | |
| |
| |
| |
Introduction to Computers and Programming | |
| |
| |
| |
Introduction | |
| |
| |
| |
Hardware | |
| |
| |
| |
How Computers Store Data | |
| |
| |
| |
How a Program Works | |
| |
| |
| |
Types of Software | |
| |
| |
Review Questions | |
| |
| |
| |
Input, Processing, and Output | |
| |
| |
| |
Designing a Program | |
| |
| |
| |
Output, Input, and Variables | |
| |
| |
| |
Variable Assignment and Calculations | |
| |
| |
In The Spotlight: Calculating Cell Phone Overage Fees | |
| |
| |
In The Spotlight: Calculating a Percentage | |
| |
| |
In The Spotlight: Calculating an Average | |
| |
| |
In The Spotlight: Converting a Math Formula to a Programming Statement | |
| |
| |
| |
Variable Declarations and Data Types | |
| |
| |
| |
Named Constants | |
| |
| |
| |
Hand Tracing a Program | |
| |
| |
| |
Documenting a Program | |
| |
| |
In The Spotlight: Using Named Constants, Style Conventions, and Comments | |
| |
| |
| |
Designing Your First Program | |
| |
| |
Review Questions | |
| |
| |
Debugging Exercises | |
| |
| |
Programming Exercises | |
| |
| |
| |
Modules | |
| |
| |
| |
Introduction to Modules | |
| |
| |
| |
Defining and Calling a Module | |
| |
| |
In The Spotlight: Defining and Calling Modules | |
| |
| |
| |
Local Variables | |
| |
| |
| |
Passing Arguments to Modules | |
| |
| |
In The Spotlight: Passing an Argument to a Module | |
| |
| |
In The Spotlight: Passing an Argument by Reference | |
| |
| |
| |
Global Variables and Global Constants | |
| |
| |
In The Spotlight: Using Global Constants | |
| |
| |
Review Questions | |
| |
| |
Debugging Exercises | |
| |
| |
Programming Exercises | |
| |
| |
| |
Decision Structures and Boolean Logic | |
| |
| |
| |
Introduction to Decision Structures | |
| |
| |
In The Spotlight: Using the if-Then Statement | |
| |
| |
| |
Dual Alternative Decision Structures | |
| |
| |
In The Spotlight: Using the If-Then-Else Statement | |
| |
| |
| |
Comparing Strings | |
| |
| |
| |
Nested Decision Structures | |
| |
| |
In The Spotlight: Multiple Nested Decision Structures | |
| |
| |
| |
The Case Structure | |
| |
| |
In The Spotlight: Using a Case Structure | |
| |
| |
| |
Logical Operators | |
| |
| |
| |
Boolean Variables | |
| |
| |
Review Questions | |
| |
| |
Debugging Exercises | |
| |
| |
Programming Exercises | |
| |
| |
| |
Repetition Structures | |
| |
| |
| |
Introduction to Repetition Structures | |
| |
| |
| |
Condition-Controlled Loops: while, Do-while, and Do-until | |
| |
| |
In The Spotlight: Designing a While Loop | |
| |
| |
In The Spotlight: Designing a Do-While Loop | |
| |
| |
| |
Count-Controlled Loops and the For Statement | |
| |
| |
In The Spotlight: Designing a Count-Controlled Loop with the For Statement | |
| |
| |
| |
Calculating a Running Total | |
| |
| |
| |
Sentinels | |
| |
| |
In The Spotlight: Using a Sentinel | |
| |
| |
| |
Nested Loops | |
| |
| |
Review Questions | |
| |
| |
Debugging Exercises | |
| |
| |
Programming Exercises | |
| |
| |
| |
Functions | |
| |
| |
| |
Introduction to Functions: Generating Random Numbers | |
| |
| |
In The Spotlight: Using Random Numbers | |
| |
| |
In The Spotlight: Using Random Numbers to Represent Other Values | |
| |
| |
| |
Writing Your Own Functions | |
| |
| |
In The Spotlight: Modularizing with Functions | |
| |
| |
| |
More Library Functions | |
| |
| |
Review Questions | |
| |
| |
Debugging Exercises | |
| |
| |
Programming Exercises | |
| |
| |
| |
Input Validation | |
| |
| |
| |
Garbage In, Garbage Out | |
| |
| |
| |
The Input Validation Loop | |
| |
| |
In The Spotlight: Designing an Input Validation Loop | |
| |
| |
| |
Defensive Programming | |
| |
| |
Review Questions | |
| |
| |
Debugging Exercises | |
| |
| |
Programming Exercises | |
| |
| |
| |
Arrays | |
| |
| |
| |
Array Basics | |
| |
| |
In The Spotlight: Using Array Elements in a Math Expression | |
| |
| |
| |
Sequentially Searching an Array | |
| |
| |
| |
Processing the Contents of an Array | |
| |
| |
In The Spotlight: Processing an Array | |
| |
| |
| |
Parallel Arrays | |
| |
| |
In The Spotlight: Using Parallel Arrays | |
| |
| |
| |
Two-Dimensional Arrays | |
| |
| |
In The Spotlight: Using a Two-Dimensional Array | |
| |
| |
| |
Arrays of Three or More Dimensions | |
| |
| |
Review Questions | |
| |
| |
Debugging Exercises | |
| |
| |
Programming Exercises | |
| |
| |
| |
Sorting and Searching Arrays | |
| |
| |
| |
The Bubble Sort Algorithm | |
| |
| |
In The Spotlight: Using the Bubble Sort Algorithm | |
| |
| |
| |
The Selection Sort Algorithm | |
| |
| |
| |
The Insertion Sort Algorithm | |
| |
| |
| |
The Binary Search Algorithm | |
| |
| |
In The Spotlight: Using the Binary Search Algorithm | |
| |
| |
Review Questions | |
| |
| |
Debugging Exercise | |
| |
| |
Programming Exercises | |
| |
| |
| |
Files | |
| |
| |
| |
Introduction to File Input and Output | |
| |
| |
| |
Using Loops to Process Files | |
| |
| |
In The Spotlight: Working with Files | |
| |
| |
| |
Using Files and Arrays | |
| |
| |
| |
Processing Records | |
| |
| |
In The Spotlight: Adding and Displaying Records | |
| |
| |
In The Spotlight: Searching for a Records | |
| |
| |
In The Spotlight: Modifying Records | |
| |
| |
In The Spotlight: Deleting Records | |
| |
| |
| |
Control Break Logic | |
| |
| |
In The Spotlight: Using Control Break Logic | |
| |
| |
Review Questions | |
| |
| |
Debugging Exercise | |
| |
| |
Programming Exercises | |
| |
| |
| |
Menu-Driven Programs | |
| |
| |
| |
Introduction to Menu-Driven Programs | |
| |
| |
| |
Modularizing a Menu-Driven Program | |
| |
| |
| |
Using a Loop to Repeat the Menu | |
| |
| |
In The Spotlight: Designing a Menu-Driven Program | |
| |
| |
| |
Multiple-Level Menus | |
| |
| |
Review Questions | |
| |
| |
Programming Exercises | |
| |
| |
| |
Text Processing | |
| |
| |
| |
Introduction | |
| |
| |
| |
Character-by-Character Text Processing | |
| |
| |
In The Spotlight: Validating a Password | |
| |
| |
In The Spotlight: Formatting and Unformatting Telephone Numbers | |
| |
| |
Review Questions | |
| |
| |
Debugging Exercises | |
| |
| |
Programming Exercises | |
| |
| |
| |
Recursion | |
| |
| |
| |
Introduction to Recursion | |
| |
| |
| |
Problem Solving with Recursion | |
| |
| |
| |
Examples of Recursive Algorithms | |
| |
| |
Review Questions | |
| |
| |
Programming Exercises | |
| |
| |
| |
Object-Oriented Programming | |
| |
| |
| |
Procedural and Object-Oriented Programming | |
| |
| |
| |
Classes | |
| |
| |
| |
Using the Unified Modeling Language to Design Classes | |
| |
| |
| |
Finding the Classes and Their Responsibilities in a Problem | |
| |
| |
In The Spotlight: Finding the Classes in a Problem | |
| |
| |
In The Spotlight: Determining Class Responsibilities | |
| |
| |
| |
Inheritance | |
| |
| |
| |
Polymorphism | |
| |
| |
Review Questions | |
| |
| |
Programming Exercises | |
| |
| |
| |
�U1 Applications and Event-Driven Programming | |
| |
| |
| |
Graphical User Interfaces | |
| |
| |
| |
Designing the User Interface for a GUI Program | |
| |
| |
In The Spotlight: Designing a Window | |
| |
| |
| |
Writing Event Handlers | |
| |
| |
In The Spotlight: Designing an Event Handler | |
| |
| |
Review Questions | |
| |
| |
Programming Exercises | |
| |
| |
| |
ASCII/Unicode Characters | |
| |
| |
| |
Flowchart Symbols | |
| |
| |
| |
Pseudocode Reference | |
| |
| |
| |
Answers to Checkpoint Questions (located on the CD that accompanies this book) | |
| |
| |
Index | |