| |
| |
Preface | |
| |
| |
| |
Introduction | |
| |
| |
In the Everyday World: Computers Everywhere | |
| |
| |
| |
A Brief History of Computers | |
| |
| |
What Is a Computer? | |
| |
| |
Personal Computers | |
| |
| |
The Internet | |
| |
| |
| |
Computer Basics | |
| |
| |
The Central Processing Unit | |
| |
| |
Internal Memory | |
| |
| |
Mass Storage Devices | |
| |
| |
Input Devices | |
| |
| |
Output Devices | |
| |
| |
| |
Software and Programming Languages | |
| |
| |
Types of Software | |
| |
| |
Types of Programming Languages | |
| |
| |
Chapter Review and Exercises | |
| |
| |
| |
An Introduction to Programming | |
| |
| |
In the Everyday World: You Are Already a Programmer! | |
| |
| |
| |
What Is Programming? | |
| |
| |
A General Problem-Solving Strategy | |
| |
| |
Creating Computer Programs: the Program Development Cycle | |
| |
| |
| |
Basic Programming Concepts | |
| |
| |
A Simple Program | |
| |
| |
Data Input | |
| |
| |
Program Variables and Constants | |
| |
| |
| |
Data Processing and Output | |
| |
| |
Processing Data | |
| |
| |
Data Output | |
| |
| |
| |
Character and String Data | |
| |
| |
The Declare Statement | |
| |
| |
| |
Integer Data | |
| |
| |
Operations on Integers | |
| |
| |
The Binary Number System | |
| |
| |
Integer Representation | |
| |
| |
| |
Floating Point Data | |
| |
| |
The Declare Statement Revisited | |
| |
| |
Types of Floating Point Numbers | |
| |
| |
Floating Point Representation | |
| |
| |
Chapter Review and Exercises | |
| |
| |
| |
Developing a Program | |
| |
| |
In the Everyday World: Planning to Program? You Need a Plan | |
| |
| |
| |
The Program Development Cycle | |
| |
| |
The Process of Developing a Program | |
| |
| |
Additional Steps in the Cycle | |
| |
| |
| |
Program Design | |
| |
| |
Modular Programming | |
| |
| |
| |
Coding, Documenting, and Testing a Program | |
| |
| |
Coding and Documenting a Program | |
| |
| |
Testing a Program | |
| |
| |
Types of Errors | |
| |
| |
| |
Commercial Programs: Testing and Documenting | |
| |
| |
The Testing Phase Revisited | |
| |
| |
External Documentation | |
| |
| |
| |
Structured Programming | |
| |
| |
Flowcharts | |
| |
| |
Control Structures | |
| |
| |
Programming Style | |
| |
| |
Chapter Review and Exercises | |
| |
| |
| |
Selection Structures: Making Decisions | |
| |
| |
In the Everyday World: Decisions, Decisions, Decisions | |
| |
| |
| |
An Introduction to Selection Structures | |
| |
| |
Types of Selection Structures | |
| |
| |
Single- and Dual-Alternative Structures | |
| |
| |
| |
Relational and Logical Operators | |
| |
| |
Relational Operators | |
| |
| |
Logical Operators | |
| |
| |
Hierarchy of Operations | |
| |
| |
| |
ASCII Code and Comparing Strings | |
| |
| |
Representing Characters by Numbers | |
| |
| |
| |
Selecting from Several Alternatives | |
| |
| |
Using If Structures | |
| |
| |
Using Case-Like Statements | |
| |
| |
| |
Applications of Selection Structures | |
| |
| |
Defensive Programming | |
| |
| |
Menu-Driven Programs | |
| |
| |
| |
Focus on Problem Solving: A New Car Price Calculator | |
| |
| |
Problem Statement | |
| |
| |
Problem Analysis | |
| |
| |
Program Design | |
| |
| |
Program Code | |
| |
| |
Program Test | |
| |
| |
Chapter Review and Exercises | |
| |
| |
| |
Repetition Structures: Looping | |
| |
| |
In the Everyday World: Loops | |
| |
| |
| |
An Introduction to Repetition Structures: Computers Never Get Bored! | |
| |
| |
Loop Basics | |
| |
| |
Relational and Logical Operators | |
| |
| |
Constructing Flowcharts with a Loop Structure | |
| |
| |
| |
Types of Loops | |
| |
| |
Pre-Test and Post-Test Loops | |
| |
| |
Counter-Controlled Loops | |
| |
| |
| |
The For Loop | |
| |
| |
The For Statement | |
| |
| |
The For Loop in Action | |
| |
| |
The Careful Bean Counter | |
| |
| |
| |
Applications of Repetition Structures | |
| |
| |
Using Sentinel-Controlled Loops to Input Data | |
| |
| |
Data Validation | |
| |
| |
The Floor() and Ceiling() Functions | |
| |
| |
Computing Sums and Averages | |
| |
| |
| |
Focus on Problem Solving: A Cost, Revenue, and Profit Problem | |
| |
| |
Problem Statement | |
| |
| |
Problem Analysis | |
| |
| |
Program Design | |
| |
| |
Program Code | |
| |
| |
Program Test | |
| |
| |
Chapter Review and Exercises | |
| |
| |
| |
More about Loops and Decisions | |
| |
| |
In the Everyday World: Advanced Loops | |
| |
| |
| |
Combining Loops with If-Then Statements | |
| |
| |
Exiting a Loop Early | |
| |
| |
| |
Combining Loops with If-Then Structures in Longer Programs | |
| |
| |
The Length_of() Function | |
| |
| |
The Print Statement and the New Line Indicator | |
| |
| |
| |
Random Numbers | |
| |
| |
The Random Function | |
| |
| |
Not Really Random: the Pseudorandom Number | |
| |
| |
| |
Nested Loops | |
| |
| |
Nested For Loops | |
| |
| |
Nesting Other Kinds of Loops | |
| |
| |
A Mental Workout: Mind Games | |
| |
| |
| |
Focus on Problem Solving: A Guessing Game | |
| |
| |
Problem Statement | |
| |
| |
Problem Analysis | |
| |
| |
Program Design | |
| |
| |
Program Code | |
| |
| |
Program Test | |
| |
| |
Chapter Review and Exercises | |
| |
| |
| |
Arrays: Lists and Tables | |
| |
| |
In the Everyday World: Arrays | |
| |
| |
| |
One-Dimensional Arrays | |
| |
| |
Array Basics | |
| |
| |
Parallel Arrays | |
| |
| |
Some Advantages of Using Arrays | |
| |
| |
| |
Searching and Sorting Arrays | |
| |
| |
The Serial Search Technique | |
| |
| |
The Bubble Sort Technique | |
| |
| |
| |
More about Searching and Sorting | |
| |
| |
Binary Search | |
| |
| |
Selection Sort | |
| |
| |
| |
Strings as Arrays of Characters | |
| |
| |
Concatenation Revisited | |
| |
| |
String Length versus Array Size | |
| |
| |
| |
Two-Dimensional Arrays | |
| |
| |
An Introduction to Two-Dimensional Arrays | |
| |
| |
Using Two-Dimensional Arrays | |
| |
| |
| |
Focus on Problem Solving: A Grade Management Program | |
| |
| |
Problem Statement | |
| |
| |
Problem Analysis | |
| |
| |
Program Design | |
| |
| |
Program Code | |
| |
| |
Program Test | |
| |
| |
Chapter Review and Exercises | |
| |
| |
| |
Program Modules, Subprograms, and Functions | |
| |
| |
In the Everyday World: Living and Programming in Manageable | |
| |
| |
Pieces: Subprograms | |
| |
| |
| |
Data Flow Diagrams and Parameters | |
| |
| |
The Big Sale: the Sale Price Computation Program | |
| |
| |
Data Flow Diagrams | |
| |
| |
An Introduction to Arguments and Parameters | |
| |
| |
| |
More about Subprograms | |
| |
| |
Value and Reference Parameters | |
| |
| |
How to Tell the Difference between Value and Reference Parameters | |
| |
| |
Two Helpful Functions: ToUpper() and ToLower() | |
| |
| |
The Scope of a Variable | |
| |
| |
| |
Functions | |
| |
| |
Built-in Functions | |
| |
| |
User-Defined Functions | |
| |
| |
| |
Recursion | |
| |
| |
The Recursive Process | |
| |
| |
| |
Focus on Problem Solving: A Grade Management Program | |
| |
| |
Problem Statement | |
| |
| |
Problem Analysis | |
| |
| |
Program Design | |
| |
| |
Program Code | |
| |
| |
Program Test | |
| |
| |
Chapter Review and Exercises | |
| |
| |
| |
Sequential Data Files | |
| |
| |
In the Everyday World: Data Files | |
| |
| |
| |
An Introduction to Data Files | |
| |
| |
File Basics | |
| |
| |
Creating and Reading Sequential Files | |
| |
| |
| |
Modifying a Sequential File | |
| |
| |
Deleting Records | |
| |
| |
Modifying Records | |
| |
| |
Inserting Records | |
| |
| |
Using Arrays in File Maintenance | |
| |
| |
| |
Merging Sequential Files | |
| |
| |
| |
Focus on Problem Solving: Control Break Processing | |
| |
| |
Problem Statement | |
| |
| |
Problem Analysis | |
| |
| |
Program Design | |
| |
| |
Coding and Testing the Program | |
| |
| |
| |
Focus on Problem Solving: the Invoice Preparation Program | |
| |
| |
Problem Statement | |
| |
| |
Problem Analysis | |
| |
| |
Program Design | |
| |
| |
Program Code | |
| |
| |
Program Test | |
| |
| |
Chapter Review and Exercises | |
| |
| |
| |
An Introduction to Object-Oriented Programming | |
| |
| |
In the Everyday World: Objects | |
| |
| |
| |
Classes and Objects | |
| |
| |
Classes | |
| |
| |
Defining Classes and Creating Objects | |
| |
| |
Creating Objects | |
| |
| |
The Constructor | |
| |
| |
| |
More Features of Object-Oriented Programming | |
| |
| |
Benefits of Object-Oriented Languages | |
| |
| |
Inheritance and Polymorphism | |
| |
| |
| |
Object-Oriented Program Design and UML | |
| |
| |
Modeling Languages | |
| |
| |
Unified Modeling Language | |
| |
| |
| |
Focus on Problem Solving: Using OOP to Create the Parking Lot | |
| |
| |
Program | |
| |
| |
Problem Statement | |
| |
| |
Problem Analysis | |
| |
| |
Program Design | |
| |
| |
Creating the Necessary Submodules | |
| |
| |
Program Code | |
| |
| |
Program Test | |
| |
| |
Chapter Review and Exercises | |
| |
| |
| |
Decimal, Binary, and Hexadecimal Representation | |
| |
| |
| |
Bases and Exponents | |
| |
| |
Expanded Notation | |
| |
| |
| |
The Binary System | |
| |
| |
Converting Binary to Decimal | |
| |
| |
| |
The Hexadecimal System | |
| |
| |
Hexadecimal Digits | |
| |
| |
Converting Decimal to Hexadecimal | |
| |
| |
Converting Hexadecimal to Decimal | |
| |
| |
Using Hexadecimal Notation | |
| |
| |
Converting Binary to Hexadecimal | |
| |
| |
Appendix B: Integer Representation | |
| |
| |
| |
Unsigned Integer Format | |
| |
| |
Overflow | |
| |
| |
| |
Sign and Magnitude Format | |
| |
| |
Representation of Sign-and-Magnitude Integers | |
| |
| |
The Zero | |
| |
| |
| |
One's Complement Format | |
| |
| |
The Zero Again | |
| |
| |
| |
Two's Complement Format | |
| |
| |
The Two's Complement Zero | |
| |
| |
Why the Two's Complement Works | |
| |
| |
Appendix C: Floating Point Number Representation | |
| |
| |
| |
Binary Conversions to Floating Point | |
| |
| |
Floating Point Numbers���the Integer Part | |
| |
| |
Floating Point Numbers���the Fractional Part | |
| |
| |
Converting a Decimal Fraction to Binary | |
| |
| |
| |
Putting the Two Parts Together | |
| |
| |
| |
Scientific and Exponential Notation | |
| |
| |
Scientific Notation | |
| |
| |
Exponential Notation | |
| |
| |
| |
Base 10 Normalization | |
| |
| |
| |
Normalizing Binary Floating Point Numbers | |
| |
| |
The Excess_127 System | |
| |
| |
Base 2 Normalization | |
| |
| |
Single Precision Floating Point Numbers | |
| |
| |
| |
Hexadecimal Representation | |
| |
| |
Appendix D: Introduction to RAPTOR | |
| |
| |
| |
What Is RAPTOR? | |
| |
| |
| |
Getting Started | |
| |
| |
| |
Introduction to RAPTOR Symbols and Variables | |
| |
| |
Variables | |
| |
| |
| |
RAPTOR Symbols | |
| |
| |
Input Symbol | |
| |
| |
Assignment Symbol | |
| |
| |
Output Symbol | |
| |
| |
| |
Comments | |
| |
| |
| |
Built-in Operators and Functions | |
| |
| |
Built-in Constants | |
| |
| |
Relational Operators | |
| |
| |
Boolean (Logical) Operators | |
| |
| |
| |
Making Decisions: the Selection Symbol | |
| |
| |
| |
Repetition: the Loop Symbol | |
| |
| |
| |
The Call Symbol and Subcharts | |
| |
| |
| |
Arrays | |
| |
| |
| |
Creating and Displaying Data Files | |
| |
| |
The Redirect_Output Procedure | |
| |
| |
The Redirect_Input Procedure | |
| |
| |
The End_Of_Input Function | |
| |
| |
| |
Object-Oriented Mode | |
| |
| |
Creating a Class | |
| |
| |
Example: Using the Cube Class to Find the Volume of a Cube | |
| |
| |
Code the Methods | |
| |
| |
The Main Program | |
| |
| |
Inheritance and Polymorphism | |
| |
| |
Glossary | |
| |
| |
Index | |