| |
| |
Preface | |
| |
| |
| |
Computers, Programming, and Application Development | |
| |
| |
| |
The Computer System | |
| |
| |
What Computers Do | |
| |
| |
Computer System Components | |
| |
| |
| |
The Evolution of Programming Languages | |
| |
| |
First-Generation Language | |
| |
| |
Second-Generation Languages | |
| |
| |
Third-Generation Languages | |
| |
| |
Fourth- and Fifth-Generation Languages | |
| |
| |
The Java Programming Language | |
| |
| |
| |
Application Development Overview | |
| |
| |
Problem Solving | |
| |
| |
Algorithms | |
| |
| |
Systems Development Life Cycle (SDLC) | |
| |
| |
Procedural Programming | |
| |
| |
Object-Oriented Systems Development | |
| |
| |
| |
Getting Started with Java | |
| |
| |
Download the JDK | |
| |
| |
View the Contents of the JDK | |
| |
| |
Set the Path Variable in Windows XP | |
| |
| |
Creating Your First Java Program | |
| |
| |
| |
Chapter Summary | |
| |
| |
Key Terms | |
| |
| |
Review Questions | |
| |
| |
Programming Exercises | |
| |
| |
| |
Fundamentals of Java Programming | |
| |
| |
| |
Anatomy of a Java Program | |
| |
| |
Application Hierarchy | |
| |
| |
Java Programming Conventions | |
| |
| |
Planning a Program | |
| |
| |
A Java Program Template | |
| |
| |
Understand the Problem | |
| |
| |
Plan the Application | |
| |
| |
Code the Application | |
| |
| |
Compile and Test | |
| |
| |
Deploy the Application | |
| |
| |
| |
Data in Java Programs | |
| |
| |
Literals | |
| |
| |
Variables | |
| |
| |
Combining Literals and Variables | |
| |
| |
Escape Sequences | |
| |
| |
Primitive Data Types | |
| |
| |
Variable Declaration and Initialization | |
| |
| |
Assigning Values to Variables | |
| |
| |
Type Casting | |
| |
| |
Named Constants | |
| |
| |
Understand the Problem | |
| |
| |
Plan the Application | |
| |
| |
Code the Application | |
| |
| |
Compile and Test | |
| |
| |
Deploy the Application | |
| |
| |
| |
Arithmetic Operators and Expressions | |
| |
| |
Arithmetic Operators | |
| |
| |
Arithmetic Expressions | |
| |
| |
Unary Negation | |
| |
| |
Addition and Subtraction | |
| |
| |
Multiplication and Division | |
| |
| |
Modulus Operator | |
| |
| |
Operator Precedence | |
| |
| |
Combined Assignment Operators | |
| |
| |
Operators and Expressions: Following Good Programming Practices | |
| |
| |
Understand the Problem | |
| |
| |
Plan the Application | |
| |
| |
Code the Application | |
| |
| |
Compile and Test | |
| |
| |
Deploy the Application | |
| |
| |
| |
Simple Program Input and Output | |
| |
| |
The JOptionPane Class | |
| |
| |
The Scanner Class | |
| |
| |
Comparing JOptionPane and Scanner | |
| |
| |
Understand the Problem | |
| |
| |
Plan the Application | |
| |
| |
Code the Application | |
| |
| |
Compile and Test | |
| |
| |
Deploy the Application | |
| |
| |
| |
Case Study: MusicWorld | |
| |
| |
| |
Chapter Summary | |
| |
| |
Key Terms | |
| |
| |
Review Questions | |
| |
| |
Programming Exercises | |
| |
| |
| |
Making Decisions with Java | |
| |
| |
| |
Comparing Numbers in Java | |
| |
| |
Relational Operators | |
| |
| |
Comparing Different Data Types | |
| |
| |
Understand the Problem | |
| |
| |
Plan the Application | |
| |
| |
Write the Code | |
| |
| |
Deploy the Application | |
| |
| |
| |
Comparing Strings in Java | |
| |
| |
Strings as Objects | |
| |
| |
The String Class | |
| |
| |
The Method compareTo | |
| |
| |
The Method equals | |
| |
| |
Understand the Problem | |
| |
| |
Plan the Application | |
| |
| |
Write the Code | |
| |
| |
Compile and Test | |
| |
| |
Deploy the Application | |
| |
| |
| |
Logical (Boolean) Operators and Order of Precedence | |
| |
| |
Logical (Boolean) Operators | |
| |
| |
Order of Precedence | |
| |
| |
Understand the Problem | |
| |
| |
Plan the Application | |
| |
| |
Write the Code | |
| |
| |
Compile and Test | |
| |
| |
Deploy the Application | |
| |
| |
| |
Selection Structures in Java | |
| |
| |
One-Way Selection | |
| |
| |
Two-Way Selection | |
| |
| |
Nested if...else Statements | |
| |
| |
The switch Statement | |
| |
| |
A switch Example | |
| |
| |
Understand the Problem | |
| |
| |
Plan the Application | |
| |
| |
Write the Code | |
| |
| |
Compile and Test | |
| |
| |
Deploy the Application | |
| |
| |
| |
Case Study: Music World | |
| |
| |
| |
Chapter Summary | |
| |
| |
Key Terms | |
| |
| |
Review Questions | |
| |
| |
Programming Exercises | |
| |
| |
| |
Repeating Program Statements | |
| |
| |
| |
The while Statement | |
| |
| |
The while Statement's Syntax | |
| |
| |
Flowchart for a while Loop | |
| |
| |
Counter-Controlled while Loops | |
| |
| |
Sentinel-Controlled while Loops | |
| |
| |
Understand the Problem | |
| |
| |
Plan the Application | |
| |
| |
Write the Code | |
| |
| |
Compile and Test | |
| |
| |
Deploy the Application | |
| |
| |
| |
The for Statement | |
| |
| |
The for Statement's Syntax | |
| |
| |
Understand the Problem | |
| |
| |
Plan the Application | |
| |
| |
Write the Code | |
| |
| |
Compile and Test | |
| |
| |
Deploy the Application | |
| |
| |
| |
The do ... while Statement | |
| |
| |
The do ... while Statement's Syntax | |
| |
| |
The do ... while Flowchart | |
| |
| |
A do ... while Example | |
| |
| |
Understand the Problem | |
| |
| |
Plan the Application | |
| |
| |
Write the Code | |
| |
| |
Compile and Test | |
| |
| |
Deploy the Application | |
| |
| |
| |
Nested Loops, break, and continue | |
| |
| |
Nested Loops | |
| |
| |
The break Statement in Loops | |
| |
| |
The continue Statement | |
| |
| |
A Caveat About break and continue | |
| |
| |
| |
Case Study: MusicWorld | |
| |
| |
| |
Chapter Summary | |
| |
| |
Key Terms | |
| |
| |
Review Questions | |
| |
| |
Programming Exercises | |
| |
| |
| |
Methods and Classes | |
| |
| |
| |
Predefined Java Methods | |
| |
| |
Working with Mathematical Functions | |
| |
| |
Working with Strings | |
| |
| |
Formatting Numbers | |
| |
| |
Working with Times and Dates | |
| |
| |
Understand the Problem | |
| |
| |
Plan the Application | |
| |
| |
Write the Code | |
| |
| |
Compile and Test | |
| |
| |
Deploy the Application | |
| |
| |
| |
Programmer-Defined Methods | |
| |
| |
Overview of Programmer-Defined Methods | |
| |
| |
Anatomy of Programmer-Defined Methods and Method Calls | |
| |
| |
Passing Data to Methods: Primitive Variables and Reference Variables | |
| |
| |
The Scope of Variables | |
| |
| |
Understand the Problem | |
| |
| |
Plan the Application | |
| |
| |
Write the Code | |
| |
| |
Compile and Test | |
| |
| |
Deploy the Application | |
| |
| |
| |
Case Study: MusicWorld | |
| |
| |
The Flowchart for MusicWorldApp5 | |
| |
| |
Program Code for MusicWorldApp5 | |
| |
| |
| |
Chapter Summary | |
| |
| |
Key Terms | |
| |
| |
Review Questions | |
| |
| |
Programming Exercises | |
| |
| |
| |
Arrays | |
| |
| |
| |
The One-Dimensional Array | |
| |
| |
Declaring an Array | |
| |
| |
Creating an Array | |
| |
| |
Initializing an Array | |
| |
| |
Accessing an Array | |
| |
| |
Parallel Arrays | |
| |
| |
Understand the Problem | |
| |
| |
Plan the Application | |
| |
| |
Write the Code | |
| |
| |
Compile and Test | |
| |
| |
Deploy the Application | |
| |
| |
| |
Multidimensional Arrays | |
| |
| |
Two-Dimensional Arrays | |
| |
| |
Ragged Arrays | |
| |
| |
Arrays of Three or More Dimensions | |
| |
| |
Understand the Problem | |
| |
| |
Plan the Application | |
| |
| |
Write the Code | |
| |
| |
Compile and Test | |
| |
| |
Deploy the Application | |
| |
| |
| |
Other Array Topics | |
| |
| |
Passing Arrays to Methods | |
| |
| |
Predefined Methods for Arrays | |
| |
| |
| |
Case Study: MusicWorld | |
| |
| |
| |
Chapter Summary | |
| |
| |
Key Terms | |
| |
| |
Review Questions | |
| |
| |
Programming Exercises | |
| |
| |
| |
Characters, Strings, and Formatting | |
| |
| |
| |
Working with Characters | |
| |
| |
Brief Review of the char Data Type | |
| |
| |
Methods in the Character Class | |
| |
| |
Understand the Problem | |
| |
| |
Plan the Application | |
| |
| |
Write the Code | |
| |
| |
Compile and Test | |
| |
| |
Deploy the Application | |
| |
| |
| |
Working with Strings | |
| |
| |
Brief Review of the String Class | |
| |
| |
The StringBuilder Class | |
| |
| |
The StringTokenizer Class | |
| |
| |
Understand the Problem | |
| |
| |
Plan the Application | |
| |
| |
Write the Code | |
| |
| |
Compile and Test | |
| |
| |
Deploy the Application | |
| |
| |
| |
Formatting Data for Output | |
| |
| |
The printf and format Methods | |
| |
| |
The format Method | |
| |
| |
| |
Case Study: MusicWorld | |
| |
| |
Flowcharts for New Features of MusicWorldApp7.java | |
| |
| |
Program Code for MusicWorldApp7.java | |
| |
| |
| |
Chapter Summary | |
| |
| |
Key Terms | |
| |
| |
Review Questions | |
| |
| |
Programming Exercises | |
| |
| |
| |
Exceptions and Assertions | |
| |
| |
| |
Exception Handling | |
| |
| |
An Example of a Thrown Exception | |
| |
| |
Handling Errors with Program Logic | |
| |
| |
Handling Exceptions with the try Statement | |
| |
| |
Classifying Exceptions | |
| |
| |
Multiple Catch Blocks and Programmer-Defined Exceptions | |
| |
| |
Propagating Exceptions | |
| |
| |
Understand the Problem | |
| |
| |
Plan the Application | |
| |
| |
Write the Code | |
| |
| |
Compile and Test | |
| |
| |
Deploy the Application | |
| |
| |
| |
Assertions | |
| |
| |
Using an Assertion | |
| |
| |
An Example of an Assertion | |
| |
| |
| |
Case Study: MusicWorld | |
| |
| |
Flowcharts for New Features of MusicWorldApp8.java | |
| |
| |
Program Code for MusicWorldApp8.java | |
| |
| |
| |
Chapter Summary | |
| |
| |
Key Terms | |
| |
| |
Review Questions | |
| |
| |
Programming Exercises | |
| |
| |
| |
File Input and Output | |
| |
| |
| |
Inputting Data from a Text File | |
| |
| |
Text File Organization | |
| |
| |
The File Class | |
| |
| |
The FileReader and BufferedReader Classes | |
| |
| |
Understand the Problem | |
| |
| |
Plan the Application | |
| |
| |
Compile and Test | |
| |
| |
Deploy the Application | |
| |
| |
| |
Outputting Data to a Text File | |
| |
| |
The File Class | |
| |
| |
The FileWriter and PrintWriter Classes | |
| |
| |
Understand the Problem | |
| |
| |
Plan the Application | |
| |
| |
Write the Code | |
| |
| |
Compile and Test | |
| |
| |
Deploy the Application | |
| |
| |
| |
Performing Input and Output with Binary Files | |
| |
| |
Identifying an Input/Output File | |
| |
| |
Writing to a Binary File | |
| |
| |
Reading from a Binary File | |
| |
| |
| |
Case Study: MusicWorld | |
| |
| |
Flowcharts for New Features of MusicWorldApp9.java | |
| |
| |
Program Code for MusicWorldApp9.java | |
| |
| |
| |
Chapter Summary | |
| |
| |
Key Terms | |
| |
| |
Review Questions | |
| |
| |
Programming Exercises | |
| |
| |
| |
Graphical User Interfaces | |
| |
| |
| |
Creating User Interfaces | |
| |
| |
A Console User Interface | |
| |
| |
A Simple GUI | |
| |
| |
A More Complete GUI | |
| |
| |
| |
Overview of a Java GUI | |
| |
| |
GUI Components: Swing vs. AWT | |
| |
| |
A GUI Class Hierarchy | |
| |
| |
The Component Class and Layout Manager Classes | |
| |
| |
| |
Developing a Java GUI | |
| |
| |
The JFrame Class | |
| |
| |
The JLabel Class | |
| |
| |
The JTextField Class | |
| |
| |
The JButton Class | |
| |
| |
Understand the Problem | |
| |
| |
Plan the Application | |
| |
| |
Write the Code | |
| |
| |
Compile and Test | |
| |
| |
Deploy the Application | |
| |
| |
| |
Adding Functionality to a GUI | |
| |
| |
Event-Driven Programming | |
| |
| |
How to Implement Event Handling | |
| |
| |
Understand the Problem | |
| |
| |
Plan the Application | |
| |
| |
Write the Code | |
| |
| |
Compile and Test | |
| |
| |
Deploy the Application | |
| |
| |
| |
Improving GUI Layout | |
| |
| |
The JPanel Class | |
| |
| |
The FlowLayout Class | |
| |
| |
The BorderLayout Class | |
| |
| |
| |
Case Study: MusicWorld | |
| |
| |
Flowcharts for New Features of MusicWorldApp10.java | |
| |
| |
Program Code for Music WorldApp10.java | |
| |
| |
| |
Chapter Summary | |
| |
| |
Key Terms | |
| |
| |
Review Questions | |
| |
| |
Programming Exercises | |
| |
| |
| |
Object-Oriented Application Development: Part I | |
| |
| |
| |
Overview of OO Application Development | |
| |
| |
Attributes and Behaviors of Objects | |
| |
| |
Structured Application Development | |
| |
| |
Object-Oriented Application Development | |
| |
| |
Understand the Problem | |
| |
| |
| |
Objects and Classes | |
| |
| |
Objects | |
| |
| |
Classes | |
| |
| |
The Visibility of Instance Variables and Methods | |
| |
| |
Understand the Problem | |
| |
| |
Plan the Application | |
| |
| |
Write the Code | |
| |
| |
Compile and Test | |
| |
| |
| |
A Complete OO Application | |
| |
| |
Application Classes | |
| |
| |
Encapsulation | |
| |
| |
Information Hiding | |
| |
| |
Object Interface | |
| |
| |
Understand the Problem | |
| |
| |
Plan the Application | |
| |
| |
Write the Code | |
| |
| |
Compile and Test | |
| |
| |
Deploy the Application | |
| |
| |
| |
Other Topics in OO Application Development | |
| |
| |
Composition | |
| |
| |
Static Class Members | |
| |
| |
Final Instance Variables | |
| |
| |
Understand the Problem | |
| |
| |
Plan the Application | |
| |
| |
Write the Code | |
| |
| |
Compile and Test | |
| |
| |
Deploy the Application | |
| |
| |
| |
Case Study: MusicWorld | |
| |
| |
Analysis of MusicWorldApp11.java | |
| |
| |
Program Code for MusicWorldApp11.java | |
| |
| |
The MusicWorld Application | |
| |
| |
| |
Chapter Summary | |
| |
| |
Key Terms | |
| |
| |
Review Questions | |
| |
| |
Programming Exercises | |
| |
| |
| |
Object-Oriented Application Development: Part II | |
| |
| |
| |
Inheritance | |
| |
| |
Inheritance and Java's Predefined Classes | |
| |
| |
Inheritance and Programmer-Defined Classes | |
| |
| |
Understand the Problem | |
| |
| |
Plan the Application | |
| |
| |
Write the Code | |
| |
| |
Compile and Test | |
| |
| |
Deploy the Application | |
| |
| |
| |
Polymorphism | |
| |
| |
Overloading | |
| |
| |
Overriding | |
| |
| |
Static (Early) and Dynamic (Late) Binding | |
| |
| |
Understand the Problem | |
| |
| |
Plan the Application | |
| |
| |
Write the Code | |
| |
| |
| |
Case Study: MusicWorld | |
| |
| |
Analysis of MusicWorldApp12.java | |
| |
| |
Program Code for the MusicWorld Application | |
| |
| |
| |
Chapter Summary | |
| |
| |
Key Terms | |
| |
| |
Review Questions | |
| |
| |
Programming Exercises | |
| |
| |
| |
An Introduction to the UML | |
| |
| |
| |
Overview of UML | |
| |
| |
Modeling a Software System | |
| |
| |
What Is the UML? | |
| |
| |
History of UML | |
| |
| |
| |
Structural Diagrams | |
| |
| |
The Class Diagram | |
| |
| |
The Object Diagram | |
| |
| |
The Component Diagram | |
| |
| |
The Deployment Diagram | |
| |
| |
Understand the Problem | |
| |
| |
Identify Possible Classes | |
| |
| |
The Class Diagram | |
| |
| |
An Object Diagram | |
| |
| |
The Component Diagram | |
| |
| |
The Deployment Diagram | |
| |
| |
| |
Behavioral Diagrams | |
| |
| |
Use Case Diagrams | |
| |
| |
Sequence Diagrams | |
| |
| |
Activity Diagrams | |
| |
| |
Communication Diagrams | |
| |
| |
State Machine Diagrams | |
| |
| |
Understand the Problem | |
| |
| |
Use Case Diagram | |
| |
| |
Sequence Diagram | |
| |
| |
Activity Diagram | |
| |
| |
Communication Diagram | |
| |
| |
State Machine Diagram | |
| |
| |
| |
Case Study: MusicWorld | |
| |
| |
The Class Diagram | |
| |
| |
The Use Case Diagram | |
| |
| |
The Sequence Diagram | |
| |
| |
| |
Chapter Summary | |
| |
| |
Key Terms | |
| |
| |
Review Questions | |
| |
| |
Diagramming Exercises | |
| |
| |
| |
An Introduction to the Unified Process | |
| |
| |
| |
The SDLC and the Unified Process | |
| |
| |
The Software Development Process in General | |
| |
| |
What Is the Unified Process? | |
| |
| |
A Construction Project: A Software Development Analogy | |
| |
| |
| |
Phases and Elements of the Unified Process | |
| |
| |
Phases of the UP | |
| |
| |
Modeling Elements of the UP | |
| |
| |
Workflows of the UP | |
| |
| |
Relationship Between UP Phases and Workflows | |
| |
| |
A Library Inventory System | |
| |
| |
| |
UP Workflows and UML Models | |
| |
| |
The Requirements Workflow | |
| |
| |
The Analysis Workflow | |
| |
| |
The Design Workflow | |
| |
| |
The Implementation and Test Workflows | |
| |
| |
Library Inventory System, Continued | |
| |
| |
| |
Case Study: MusicWorld | |
| |
| |
| |
Chapter Summary | |
| |
| |
Key Terms | |
| |
| |
Review Questions | |
| |
| |
Diagramming Exercises | |
| |
| |
Appendix | |
| |
| |
Glossary | |
| |
| |
Index | |