Java™ A Framework for Programming and Problem Solving

by ;
Edition: 1st
Format: Paperback
Pub. Date: 1998-09-25
Publisher(s): Course Technology
List Price: $98.00

Buy New

Usually ships in 2 to 3 business days.
$97.90

Rent Textbook

Select for Price
There was a problem. Please try again later.

Used Textbook

We're Sorry
Sold Out

eTextbook

We're Sorry
Not Available

How Marketplace Works:

  • This item is offered by an independent seller and not shipped from our warehouse
  • Item details like edition and cover design may differ from our description; see seller's comments before ordering.
  • Sellers much confirm and ship within two business days; otherwise, the order will be cancelled and refunded.
  • Marketplace purchases cannot be returned to eCampus.com. Contact the seller directly for inquiries; if no response within two days, contact customer service.
  • Additional shipping costs apply to Marketplace purchases. Review shipping costs at checkout.

Table of Contents

Preface xix
Chapter 1: Background
1(11)
History of Computers
1(1)
Computer Architecture
2(2)
Computer Hardware
2(2)
Computer Software
4(1)
Programming Languages
4(2)
Software Development Process
6(2)
Object-Oriented Programming
8(1)
CS Capsule: The ACM Code of Ethics and Intellectual Property
9(2)
The ACM Code of Ethics
9(2)
Copyright, Intellectual Property, and Digital Information
11(1)
Key Terms
11(1)
Chapter 2: A First Java Program
12(24)
Why Java
12(1)
The Java Virtual Machine and Byte Code
13(1)
Case Study: Request, Analysis, and Design for the First Program
13(2)
Writing the Program
15(1)
Language Elements: Vocabulary, Syntax, and Semantics
16(1)
Vocabulary
16(1)
Syntax
17(1)
Semantics
17(1)
Programming and Natural Languages
17(1)
Understanding the Program
17(5)
Variables
17(1)
A Variable's Type
18(1)
Literals
18(1)
Declaration and Assignment Statements
18(1)
Arithmetic Expressions
19(1)
Import Statements
19(1)
Program Name
19(1)
Window Objects and the User Interface
19(1)
Messages
20(1)
Methods
21(1)
Stopping the Program
22(1)
Overview of Editing, Compiling, and Running a Program
22(1)
Editing, Compiling, and Running the First Program
23(3)
Formatting a Program and Comments
26(1)
Programming Errors
27(1)
Syntax Errors
27(1)
Run-Time Errors
27(1)
Logic Errors
27(1)
Illustration of Syntax Errors
28(1)
Illustration of Run-Time Errors
29(2)
Illustration of Logic Errors
31(1)
Debugging
32(1)
Applets and Stand-Alone Programs
33(1)
CS Capsule: Intrusive Hacking and Viruses
33(1)
Key Terms
34(1)
Programming Problems and Activities
35(1)
Chapter 3: Java Basics
36(23)
Case Study 3.1: Area of a Circle
36(1)
Case Study 3.2: Income Tax Calculator
37(2)
CS Capsule: Binary Representation of Information and Computer Memory
39(3)
Numeric Data Types and Numeric Literals
42(1)
Variables and Reserved Words
43(1)
Naming Other User-Defined Symbols
44(1)
Expressions
44(2)
Mixed-Mode Arithmetic
46(1)
Tester Programs
47(1)
BreezyGUI: Layout, Objects, and Methods
48(4)
Laying Out Window Objects
48(1)
Messages and Methods for Window Objects
49(3)
Strings
52(3)
String Literals
52(1)
String Variables and String Concatenation
52(1)
Message Boxes
53(1)
Adding Newline Characters to Strings
54(1)
Text Fields
54(1)
Case Study 3.3: Vital Statistics
55(1)
Design, Testing, and Debugging Hints
56(1)
Key Terms
57(1)
Programming Problems and Activities
57(2)
Chapter 4: Control Statements
59(26)
A Visit to the Farm
59(1)
The if and if-else Statements
60(2)
Format
60(1)
Examples
61(1)
Relational Operators and Their Precedence
62(1)
Case Study 4.1: Circle Area and Radius
63(2)
The while Statement
65(5)
Format
65(1)
Three Short Examples
65(2)
A Common Loop Structure
67(1)
Logic Errors in Loops, Including Infinite Loops
67(2)
Debugging Loops
69(1)
Case Study 4.2: Count the Divisors
70(1)
Case Study 4.3: Fibonacci Numbers
71(2)
Nested if Statements
73(2)
Everyday Examples
73(1)
Determining a Student's Grade
74(1)
Data Validation and Robust Programs
75(1)
Case Study 4.4: Making Circle Area and Radius Robust
76(1)
BreexyGUI: Text Areas and Formatted Output
77(2)
Text Areas
77(1)
Formatted Output
77(2)
Case Study 4.5: A Sales Table
79(2)
CS Capsule: Artificial Intelligence, Robots, and Softbots
81(1)
Design, Testing, and Debugging Hints
82(1)
Key Terms
83(1)
Programming Problems and Activities
83(2)
Chapter 5: User-Defined Methods
85(28)
First Look at User-Defined Methods
85(2)
Cohesion of Methods
87(1)
Parameters and Return Values
88(4)
How Methods Communicate
88(2)
Overloaded Methods
90(1)
Sharing Variables Versus Passing Parameters
90(2)
Scope and Lifetime of Variables
92(2)
Preconditions and Postconditions
94(2)
CS Capsule: Function-Oriented Programming
96(1)
Case Study 5.1: Tally Grades
96(2)
Testing Strategies
98(12)
Top-Down Implementation and Testing Strategy
98(7)
Finding the Location of Run-Time Errors
105(1)
Expanding Capabilities Implementation and Testing Strategy
106(2)
Bottom-up Implementation and Testing Strategy
108(2)
Mixed Implementation and Testing Strategy
110(1)
Design, Testing, and Debugging Hints
110(1)
Key Terms
111(1)
Programming Problems and Activities
111(2)
Chapter 6: More Operators, Control Statements, and Data Types
113(20)
Operators
113(2)
Unary Plus and Minus
113(1)
Increment and Decrement Operators
113(1)
Extended Assignment Operators
114(1)
Precedence of Operators
115(1)
Control Statements
115(5)
do-while Statement
115(1)
for Statement
116(1)
switch Statement
117(1)
break Statement
118(2)
continue Statement
120(1)
Data Types
120(5)
Booleans
121(1)
Characters
121(3)
Other Numeric Data Types
124(1)
The Cast Operator
124(1)
Strings Revisited
125(4)
String Methods
125(1)
Conversion between Strings and Primitive Data Types
125(2)
Short Examples of String Manipulations
127(2)
Case Study 6.1: Palindromes
129(2)
CS Capsule: Data Encryption
131(1)
Design, Testing, and Debugging Hints
131(1)
Key Terms
131(1)
Programming Problems and Activities
131(2)
Chapter 7: Potpourri
133(25)
Constants
133(1)
The Math class
134(1)
Mixed-Mode Arithmetic Revisited
135(1)
CS Capsule: Peculiarities of Computer Arithmetic
136(2)
Case Study 7.1: Metric Conversion
138(1)
Case Study 7.2: Dice Rolling
139(1)
Nested if Statements Revisited
140(3)
Logical Errors: Calculating a Salesperson's Commission
142(1)
Logical Operators
143(5)
&& (AND)
143(1)
\\ (OR)
144(1)
! (NOT)
144(1)
Precedence of Operators
144(1)
Rewriting Nested if Statements
145(1)
&& and \\ Together
146(1)
Rewriting Complex Conditions
147(1)
Loop Invariants
148(5)
Using Loop Invariants to Reason About Loops
148(1)
Computing the GCD of Two Numbers
149(1)
Balzano Bisection
150(1)
Summing a Series
151(2)
The StringBuffer Class
153(2)
The StringTokenizer Class
155(1)
Design, Testing, and Debugging Hints
156(1)
Key Terms
156(1)
Programming Problems and Activities
156(2)
Chapter 8: User-Defined Classes
158(30)
Classes and Objects
158(1)
Three Characteristics of an Object
158(1)
Clients and Servers
159(1)
A Student Class
159(7)
Using Student Objects
160(2)
Structure of a Class Template
162(2)
Implementation of the Student Class
164(2)
Editing, Compiling, and Testing the Student Class
166(2)
Finding the Location of Run-Time Errors
167(1)
BreezyGUI: Menus and the Title
168(1)
Menus
168(1)
The setTitle Method
169(1)
Case Study: Student Test Scores
169(6)
The static Modifier
175(4)
Counting the Number of Students Instantiated
175(1)
Modifying the Student Class
175(2)
Class Constants
177(1)
Rules for Using the static Modifier
178(1)
The Math Class Revisited
178(1)
The static Method main
178(1)
Restriction on the Use of the messageBox Method
179(1)
Constructors
179(2)
Primitive Types, Reference Types, and the null Value
181(1)
Copying Objects
182(1)
Comparing Objects for Equality
183(1)
The Methods finalize and dispose
184(1)
CS Capsule: Reliability of Software Systems
184(1)
Design, Testing, and Debugging Hints
185(1)
Key Terms
185(1)
Programming Problems and Activities
186(2)
Chapter 9: Arrays: Searching and Sorting
188(54)
Conceptual View
188(1)
Simple Manipulations
189(1)
Looping Through Arrays
190(6)
Sum the Elements
190(1)
Count the Occurrences
191(1)
Determine Presence or Absence
191(1)
Determine First Location
191(1)
Locate Largest Number
192(1)
Move Smallest Number to First Position
193(1)
Move Second Smallest Number to Second Position
193(1)
Sort in Ascending Order
194(1)
Sort in Descending Order
194(1)
Insert an Element
194(1)
Delete an Element
195(1)
Declaring Arrays
196(2)
Parallel Arrays
198(2)
Two-Dimensional Arrays
200(3)
Definition
200(1)
Sum the Elements
200(1)
Sum the Rows
201(1)
Locate the Largest Number
201(1)
Declare and Instantiate
202(1)
Variable Length Rows
203(1)
Three and Higher Dimensional Arrays
203(1)
Arrays and Methods
204(3)
Sum the Elements
204(1)
Search for a Value
205(1)
Sort in Ascending Order
205(1)
Sum the Rows
206(1)
Copy an Array
206(1)
Other Objects and Methods
207(1)
BreezyGUI: Checkboxes, Radio Buttons, Scrolling Lists, and Choice Lists
207(8)
Checkboxes
209(1)
Radio Buttons
209(1)
Scrolling Lists
210(1)
Popup Choice Lists
211(1)
Code for the Demo
212(3)
Case Study 9.1: Polynomial Evaluator
215(7)
Case Study 9.2: Student Test Scores Again
222(7)
The Model/View Pattern
229(8)
Design, Testing, and Debugging Hints
237(1)
Key Terms
237(1)
Programming Problems and Activities
237(5)
Chapter 10: Inheritance, Abstract Classes, and Polymorphism
242(33)
Implementing a Simple Shape Hierarchy
242(7)
Implementing the Shape Class
243(2)
Implementing the Circle Class
245(1)
Constructors and super
246(1)
Other Methods and super
247(1)
Implementing the Rect Class
247(1)
Protected Variables and Methods
248(1)
Implementation, Extension, Overriding, and Finality
249(1)
Using the Shape Class
249(1)
Finding the Right Method
250(1)
Extending the Shape Hierarchy
250(3)
Implementing the Cylinder Class
251(1)
More About the Use of super
252(1)
Testing the Cylinder Class
253(1)
Arrays of Shapes
253(4)
Declaring an Array of Shapes
254(1)
Sending Messages to Objects in an Array of Shapes
255(2)
Shapes as Parameters and Return Values
257(3)
Rectangle In, Circle Out
257(1)
Any Shape In, Circle Out
258(1)
Any Shape In, Any Shape Out
258(2)
An Employee Hierarchy
260(2)
Case Study 10.1: The Painter's Friend
262(10)
Object-Oriented Analysis and Design Guidelines
272(2)
Objects: A Universal Means of Representation
272(1)
Analyzing Objects
272(1)
Designing Objects
273(1)
Maximizing Encapsulation
273(1)
Maximizing Inheritance
273(1)
Maximizing Polymorphism
274(1)
Key Terms
274(1)
Programming Problems and Activities
274(1)
Chapter 11: Recursion and Complexity Analysis
275(23)
Recursion
275(4)
Conceptual View
275(1)
Implementing Recursion
276(1)
Tracing Recursive Calls
277(1)
Guidelines for Writing Recursive Methods
277(1)
When to Use Recursion
278(1)
CS Capsule: Recursion Need Not Be Expensive
279(1)
Complexity Analysis
280(6)
Sum Methods
280(1)
Other O(n) Methods
281(2)
An O(n(2)) Method
283(1)
Common Big-O Values
283(2)
An O(r(n)) Method
285(1)
Binary Search
286(3)
Quick Sort
289(3)
Phase 1
289(2)
Phase 2 and Onward
291(1)
Complexity Analysis
291(1)
Implementation
291(1)
Case Study 11.1: Comparing Sort Algorithms
292(4)
Design, Testing, and Debugging Hints
296(1)
Key Terms
296(1)
Programming Problems and Activities
296(2)
Chapter 12: Simple Graphics
298(38)
The Conceptual Framework for Computer Graphics
298(6)
Coordinate Systems
298(1)
The Graphics Class
299(1)
Drawing Triangles
299(3)
Drawing Circles
302(1)
Drawing Text
302(1)
Accessing a Graphics Context
302(1)
The Method paint
303(1)
The Method repaint
303(1)
Case Study 12.1: Drawing Text at Different Positions
304(2)
Color
306(1)
Case Study 12.2: Fractals
307(3)
Data Graphs: Line, Bar, and Pie
310(6)
Line Graphs
310(3)
Bar Graphs
313(1)
Pie Charts
314(2)
Case Study 12.3: Multiple Views of Data
316(5)
Tracking the Mouse
321(1)
Case Study 12.4: A Simple Sketching Program
322(1)
Transient and Refreshable Images
323(2)
Defining and Using a Geometric Class
325(2)
Specification and Use of Circles
325(1)
Implementation of the Circle Class
325(2)
Case Study 12.5: Dragging Circles
327(4)
Text Properties
331(2)
The Class Font
332(1)
Setting the Color and Font Properties of Text
333(1)
Design, Testing, and Debugging Hints
333(1)
Key Terms
333(1)
Programming Problems and Activities
333(3)
Chapter 13: Files
336(30)
File Classes
336(2)
File Input
338(6)
Opening and Closing a FileInputStream
339(1)
Exception Handling
340(1)
Reading Data from a Text File
340(1)
Reading Data One Character at a Time
340(1)
Reading Data One Line at a Time
341(1)
Reading Data One Word at a Time
342(2)
Case Study 13.1: A Text Analyzer
344(3)
File Output
347(2)
Opening and Closing a FileOutputStream
348(1)
Writing Data to a PrintWriter
348(1)
Case Study 13.2: Employees and Payroll
349(7)
Data Input and Output Streams
356(2)
Serialization and Object Streams
358(2)
Terminal Input and Output
360(1)
File Dialogs
361(2)
CS Capsule: Programming Language Translation
363(1)
Design, Testing, and Debugging Hints
364(1)
Key Terms
365(1)
Programming Problems and Activities
365(1)
Chapter 14: Vectors and Tables
366(25)
Vectors
366(3)
Vectors and Arrays
366(2)
Vector Methods
368(1)
Tables
369(1)
Enumerations
370(1)
Wrapper Classes
371(2)
Primitive Types and Wrapper Classes
371(2)
Manipulating Primitive Types in a Vector
373(1)
BreezyGUI: Dialogs
373(3)
Case Study 14.1: An Employee Maintenance System
376(8)
Case Study 14.2: The Therapist
384(5)
Design, Testing, and Debugging Hints
389(1)
Key Terms
389(1)
Programming Problems and Activities
389(2)
Chapter 15: Abstract Data Types and Lists
391(28)
Classes as Abstract Data Types
391(1)
Plan for the Rest of the Chapter
391(1)
One-Way Lists
392(2)
The Concept of a One-Way List
392(1)
Interface for the OneWayList Class
392(1)
Using the OneWayList Class
392(2)
The Linked List Representation
394(5)
Creating a Linked List
395(1)
Moving to the Next Node
395(1)
Moving to the First Node
396(1)
Inserting Data into a Linked List
396(2)
Removing Data from a Linked List
398(1)
Accessing and Replacing Data in a Linked List
398(1)
Linked List Class Implementation
399(5)
The Node Class
399(3)
Commentary on Insertions and Removals
402(2)
The Vector Representation and Implementation
404(1)
Complexity Analysis of the Two Implementations
405(3)
Running Time of the Linked List Implementation
406(1)
Running Time of the Vector Implementation
406(1)
Dynamic Memory and the Benefits of Linked Lists
406(1)
Random Access, Sequential Access, and the Cost of Linked Lists
407(1)
Related Abstract Data Types
408(5)
Two-Way Lists
408(2)
Stacks
410(2)
Queues
412(1)
Case Study 15.1: Student Test Scores Yet Again
413(4)
Design, Testing, and Debugging Hints
417(1)
Key Terms
417(1)
Programming Problems and Activities
417(2)
Chapter 16: Introduction to HTML and Applets
419(24)
Hypertext, Hypermedia, and the World Wide Web
419(2)
Hypertext and Hypermedia
420(1)
Networks and the World Wide Web
420(1)
Overview of the Hypertext Markup Language
421(4)
A Short Example
421(2)
Markup Tags
423(1)
Minimal Document Structure
424(1)
Commenting an HTML Document
424(1)
Simple Text Elements
425(2)
Headings
425(1)
Paragraphs
425(1)
Forced Line Breaks
426(1)
Preformatted Text
426(1)
Character-Level Formatting
427(1)
Escape Sequences
427(1)
Lists
427(4)
An Unnumbered List Example
428(1)
A Definition List Example
429(1)
A Nested List Example
430(1)
Linking to Other Documents
431(2)
Pathnames
432(1)
URLs
432(1)
Multimedia
433(2)
Inline Images
433(1)
External Images
434(1)
Colors and Backgrounds
434(1)
Other Media
435(1)
Tables
435(3)
Typical Table Format
436(1)
A Simple Example
437(1)
Applets
438(4)
Example
438(2)
Converting an Application to an Applet
440(1)
Constraints on Applets
441(1)
Passing Parameters to Applets
441(1)
Design, Testing, and Debugging Hints
442(1)
Key Terms
442(1)
Programming Problems and Activities
442(1)
Chapter 17: The AWT
443(52)
The AWT Philosophy
443(1)
Conversion Program Implemented with GBFrame
444(1)
Conversion Program Implemented with AWT
445(6)
The Interface
446(1)
The File ConversionWithAWT.java
446(3)
The File FahrenheitButtonListener.java
449(1)
The File CentigradeButtonListener.java
w450(1)
The File GenericWindowListener.java
451(1)
Variations on Implementing with AWT
451(7)
Combining the Button Listeners
451(1)
Simplifying the GenericWindowListener Class
452(1)
Incorporating the Listeners into the Main GUI Class
453(2)
Filtering Out Alphabetic Characters
455(3)
GUI Components
458(5)
The Component Class Hierarchy
458(1)
Canvases
459(1)
Scroll Bars
459(1)
Menu Components
459(2)
Popup Menus
461(1)
Container Classes
462(1)
Layouts
463(10)
Border Layouts
463(2)
Flow Layouts
465(2)
Grid Layouts
467(1)
Grid Bag Layouts
468(3)
Card Layouts
471(1)
Panels
472(1)
All About Events
473(9)
Events and Components
473(2)
Events and Listeners
475(1)
Events and Their Methods
475(1)
Experimenting with Events
475(7)
Dialogs
482(4)
The Model/View/Controller Pattern
486(1)
Case Study 17.1: A Color Meter Application
486(6)
Applets and the AWT
492(1)
Key Terms
493(1)
Programming Problems and Activities
494(1)
Appendix A Java Resources 495(2)
Appendix B Reserved Words 497(1)
Appendix C Operator Precedence 498(2)
Appendix D ASCII Character Set 500(1)
Appendix E Number Systems 501(3)
Appendix F Java Exception Handling 504(2)
Appendix G Java Packages 506(1)
Appendix H BreezyGUI 507(6)
Glossary 513(12)
Case Studies Index 525(2)
Java Classes Index 527(2)
Subject Index 529

An electronic version of this book is available through VitalSource.

This book is viewable on PC, Mac, iPhone, iPad, iPod Touch, and most smartphones.

By purchasing, you will be able to view this book online, as well as download it, for the chosen number of days.

Digital License

You are licensing a digital product for a set duration. Durations are set forth in the product description, with "Lifetime" typically meaning five (5) years of online access and permanent download to a supported device. All licenses are non-transferable.

More details can be found here.

A downloadable version of this book is available through the eCampus Reader or compatible Adobe readers.

Applications are available on iOS, Android, PC, Mac, and Windows Mobile platforms.

Please view the compatibility matrix prior to purchase.