SlideShare a Scribd company logo
Read Anytime Anywhere Easy Ebook Downloads at ebookluna.com
(eBook PDF) Data Structures and Other Objects
Using Java 4th Edition
https://ebookluna.com/product/ebook-pdf-data-structures-and-
other-objects-using-java-4th-edition/
OR CLICK HERE
DOWLOAD EBOOK
Visit and Get More Ebook Downloads Instantly at https://ebookluna.com
Instant digital products (PDF, ePub, MOBI) available
Download now and explore formats that suit you...
(eBook PDF) Data Structures and Problem Solving Using Java
4th Edition
https://ebookluna.com/product/ebook-pdf-data-structures-and-problem-
solving-using-java-4th-edition/
ebookluna.com
(eBook PDF) Data Structures and Abstractions with Java 4th
Edition
https://ebookluna.com/product/ebook-pdf-data-structures-and-
abstractions-with-java-4th-edition/
ebookluna.com
(eBook PDF) Data Structures and Abstractions with Java 4th
Global Edition
https://ebookluna.com/product/ebook-pdf-data-structures-and-
abstractions-with-java-4th-global-edition/
ebookluna.com
(eBook PDF) Starting Out with Java: From Control
Structures through Data Structures 4th Edition
https://ebookluna.com/product/ebook-pdf-starting-out-with-java-from-
control-structures-through-data-structures-4th-edition/
ebookluna.com
Data Structures and Abstractions with Java 5th Edition
(eBook PDF)
https://ebookluna.com/product/data-structures-and-abstractions-with-
java-5th-edition-ebook-pdf/
ebookluna.com
(eBook PDF) Starting Out with Java: From Control
Structures through Objects, 7th Edition
https://ebookluna.com/product/ebook-pdf-starting-out-with-java-from-
control-structures-through-objects-7th-edition/
ebookluna.com
(eBook PDF) Starting Out with Java: From Control
Structures through Data Structures 3rd Edition
https://ebookluna.com/product/ebook-pdf-starting-out-with-java-from-
control-structures-through-data-structures-3rd-edition/
ebookluna.com
(eBook PDF) Introduction to JAVA Programming and Data
Structures Comprehensive Version 11
https://ebookluna.com/product/ebook-pdf-introduction-to-java-
programming-and-data-structures-comprehensive-version-11/
ebookluna.com
(eBook PDF) Java Foundations: Introduction to Program
Design and Data Structures 5th Edition
https://ebookluna.com/product/ebook-pdf-java-foundations-introduction-
to-program-design-and-data-structures-5th-edition/
ebookluna.com
(eBook PDF) Data Structures and Other Objects Using Java 4th Edition
(eBook PDF) Data Structures and Other Objects Using Java 4th Edition
Preface vii
each method is presented along with a precondition/postcondition contract that
completely specifies the behavior of the method. At this level, it’s important for
the students to realize that the specification is not tied to any particular choice of
implementation techniques. In fact, this same specification may be used several
times for several different implementations of the same data type.
Step 3: Use the Data Type. With the specification in place, students can write
small applications or applets to show the data type in use. These applications are
based solely on the data type’s specification because we still have not tied down
the implementation.
Step 4: Select Appropriate Data Structures and Proceed to Design and
Implement the Data Type. With a good abstract understanding of the data
type, we can select an appropriate data structure, such as an array, a linked list of
nodes, or a binary tree of nodes. For many of our data types, a first design and
implementation will select a simple approach, such as an array. Later, we will
redesign and reimplement the same data type with a more complicated underly-
ing structure.
Because we are using Java classes, an implementation of a data type will have
the selected data structures (arrays, references to other objects, etc.) as private
instance variables of the class. In my own teaching, I stress the necessity for a
clear understanding of the rules that relate the private instance variables to the
abstract notion of the data type. I require each student to write these rules in clear
English sentences that are called the invariant of the abstract data type. Once the
invariant is written, students can proceed to implementing various methods. The
invariant helps in writing correct methods because of two facts: (a) Each method
(except the constructors) knows that the invariant is true when the method begins
its work; and (b) each method is responsible for ensuring that the invariant is
again true when the method finishes.
Step 5: Analyze the Implementation. Each implementation can be analyzed
for correctness, flexibility, and time analysis of the operations (using big-O
notation). Students have a particularly strong opportunity for these analyses
when the same data type has been implemented in several different ways.
Where Will the Students Be at the End of the Course?
At the end of our course, students understand the data types inside out. They
know how to use the data types and how to implement them in several ways.
They know the practical effects of the different implementation choices. The
students can reason about efficiency with a big-O analysis and can argue for the
correctness of their implementations by referring to the invariant of the ADT.
viii Preface
the data types in
this book are
cut-down
versions of the
Java Class
Libraries
One of the lasting effects of the course is the specification, design, and imple-
mentation experience. The improved ability to reason about programs is also
important. But perhaps most important of all is the exposure to classes that are
easily used in many situations. The students no longer have to write everything
from scratch. We tell our students that someday they will be thinking about a
problem, and they will suddenly realize that a large chunk of the work can be
done with a bag, a stack, a queue, or some such. And this large chunk of work is
work that they won’t have to do. Instead, they will pull out the bag or stack or
queue that they wrote this semester—using it with no modifications. Or, more
likely, they will use the familiar data type from a library of standard data types,
such as the proposed Java Class Libraries. In fact, the behavior of some data
types in this text is a cut-down version of the JCL, so when students take the step
to the real JCL, they will be on familiar ground—from the standpoint of how to
use the class and also having a knowledge of the considerations that went into
building the class.
Other Foundational Topics
Throughout the course, we also lay a foundation for other aspects of “real pro-
gramming,” with coverage of the following topics beyond the basic data struc-
tures material.
Object-Oriented Programming. The foundations of object-oriented pro-
gramming are laid by giving students a strong understanding of Java classes.
The important aspects of classes are covered early: the notion of a method, the
separation into private and public members, the purpose of constructors, and a
small exposure to cloning and testing for equality. This is primarily covered in
Chapter 2, some of which can be skipped by students with a good exposure to
Java classes in the CS1 course.
Further aspects of classes are introduced when the classes first use dynamic
arrays (Chapter 3). At this point, the need for a more sophisticated clone method
is explained. Teaching this OOP method with the first use of dynamic memory
has the effect of giving the students a concrete picture of how an instance vari-
able is used as a reference to a dynamic object such as an array.
Conceptually, the largest innovation of OOP is the software reuse that occurs
via inheritance. There are certainly opportunities for introducing inheritance
right from the start of a data structures course (such as implementing a set class
as a descendant of a bag class). However, an early introduction may also result
in students juggling too many new concepts at once, resulting in a weaker under-
standing of the fundamental data structures. Therefore, in my own course, I intro-
duce inheritance at the end as a vision of things to come. But the introduction to
inheritance (Sections 13.1 and 13.2) could be covered as soon as classes are
understood. With this in mind, some instructors may wish to cover Chapter 13
earlier, just before stacks and queues, so that stacks and queues can be derived
from another class.
Preface ix
Another alternative is to identify students who already know the basics of
classes. These students can carry out an inheritance project (such as the ecosys-
tem of Section 13.3), while the rest of the students first learn about classes.
Java Objects. The Java Object type lies at the base of all the other Java
types—or at least almost all the other types. The eight primitive types are not
Java objects, and for many students, the CS1 work has been primarily with the
eight primitive types. Because of this, the first few data structures are collec-
tions of primitive values, such as a bag of integers or a sequence of double num-
bers.
Iterators. Iterators are an important part of the Java Class Libraries, allowing
a programmer to easily step through the elements in a collection class. The
Iteratable interface is introduced in Chapter 5. Throughout the rest of the
text, iterators are not directly used, although they provide a good opportunity for
programming projects, such as using a stack to implement an iterator for a
binary search tree (Chapter 9).
Recursion. First-semester courses often introduce students to recursion. But
many of the first-semester examples are tail recursion, where the final act of the
method is the recursive call. This may have given students a misleading impres-
sion that recursion is nothing more than a loop. Because of this, I prefer to avoid
early use of tail recursion in a second-semester course.
So, in our second-semester course, we emphasize recursive solutions that use
more than tail recursion. The recursion chapter provides four examples along
these lines. Two of the examples—generating random fractals and traversing a
maze—are big hits with the students. The fractal example runs as a graphical
applet, and although the maze example is text based, an adventurous student can
convert it to a graphical applet. These recursion examples (Chapter 8) appear just
before trees (Chapter 9) since it is within recursive tree algorithms that recursion
becomes vital. However, instructors who desire more emphasis on recursion can
move that topic forward, even before Chapter 2.
In a course that has time for advanced tree projects (Chapter 10), we analyze
the recursive tree algorithms, explaining the importance of keeping the trees
balanced—both to improve worst-case performance and to avoid potential
execution stack overflow.
Searching and Sorting. Chapters 11 and 12 provide fundamental coverage of
searching and sorting algorithms. The searching chapter reviews binary search
of an ordered array, which many students will have seen before. Hash tables are
also introduced in the search chapter by implementing a version of the JCL hash
table and also a second hash table that uses chaining instead of open addressing.
The sorting chapter reviews simple quadratic sorting methods, but the majority
of the chapter focuses on faster algorithms: the recursive merge sort (with
worst-case time of O(n log n)), Tony Hoare’s recursive quicksort (with average-
time O(n log n)), and the tree-based heapsort (with worst-case time of O(n log n)).
x Preface
Advanced Projects, Including Concurrency
The text offers good opportunities for optional projects that can be undertaken
by a more advanced class or by students with a stronger background in a large
class. Particular advanced projects include the following:
• Interactive applet-based test programs for any of the data structures (out-
lined in Appendix I).
• Implementing an iterator for the sequence class (see Chapter 5 Program-
ming Projects).
• Writing a deep clone method for a collection class (see Chapter 5 Pro-
gramming Projects).
• Writing an applet version of an application program (such as the maze tra-
versal in Section 8.2 or the ecosystem in Section 13.3).
• Using a stack to build an iterator for the binary search tree (see Chapter 9
Programming Projects).
• A priority queue implemented as an array of ordinary queues (Section
7.4) or implemented using a heap (Section 10.1).
• A set class implemented with B-trees (Section 10.2). I have made a partic-
ular effort on this project to provide sufficient information for students to
implement the class without need of another text. Advanced students have
successfully completed this project as independent work.
• Projects to support concurrent sorting in the final section of Chapter 12.
• An inheritance project, such as the ecosystem of Section 13.3.
• A graph class and associated graph algorithms in Chapter 14. This is
another case in which advanced students may do work on their own.
Java Language Versions
All the source code in the book has been tested to work correctly with Java 2
Standard Edition Version 7.0, including new features such as generics and new
concurrency support. Information on all of the Java products from Sun Micro-
systems is available at http://java.sun.com/products/index.html.
Flexibility of Topic Ordering
This book was written to give instructors latitude in reordering the material to
meet the specific background of students or to add early emphasis to selected
topics. The dependencies among the chapters are shown on the next page. A line
joining two boxes indicates that the upper box should be covered before the
lower box.
Here are some suggested orderings of the material:
Typical Course. Start with Chapters 1–9, skipping parts of Chapter 2 if the
students have a prior background in Java classes. Most chapters can be covered
in a week, but you may want more time for Chapter 4 (linked lists), Chapter 8
(recursion), or Chapter 9 (trees). Typically, I cover the material in 13 weeks,
Preface xi
Sections 5.5–5.7
The Java API
Iterators
Java collections
Java maps
Section 10.1
Heaps
Sections 5.1–5.4
Generic programming
Chapter 6
Stacks
Chapter 7
Queues
Chapter 9
Trees
Chapter 13
Extended classes
Section 10.2
B-trees
Section 10.4
Detailed tree analysis
Chapter 12
Sorting
(Heapsort also
needs Section
10.1)
Chapter 1
Introduction
Chapters 2–3
Classes
Reference variables
Collection classes
Chapter 2 can be skipped by students
with a good background in Java classes.
Chapter 4
Linked lists
Chapter 8
Recursion
Section 11.1
Binary search
Sec. 11.2–11.3
Hash tables
(Also requires
Chapter 5)
At the start of the course, students should be comfortable writing
application programs and using arrays in Java.
Chapter 14
Graphs
Chapter Dependencies
The shaded boxes provide
good opportunities for
advanced work.
Section 10.3
Java trees
xii Preface
including time for exams and extra time for linked lists and trees. Remaining
weeks can be spent on a tree project from Chapter 10 or on binary search (Sec-
tion 11.1) and sorting (Chapter 12).
Heavy OOP Emphasis. If students will cover sorting and searching else-
where, then there is time for a heavier emphasis on object-oriented program-
ming. The first three chapters are covered in detail, and then derived classes
(Section 13.1) are introduced. At this point, students can do an interesting OOP
project, perhaps based on the ecosystem of Section 13.3. The basic data struc-
tures (Chapters 4–7) are then covered, with the queue implemented as a derived
class (Section 13.4). Finish up with recursion (Chapter 8) and trees (Chapter 9),
placing special emphasis on recursive methods.
Accelerated Course. Assign the first three chapters as independent reading in
the first week and start with Chapter 4 (linked lists). This will leave two to three
extra weeks at the end of the term so that students can spend more time on
searching, sorting, and the advanced topics (shaded in the chapter dependencies
list).
I also have taught the course with further acceleration by spending no lecture
time on stacks and queues (but assigning those chapters as reading).
Early Recursion / Early Sorting. One to three weeks may be spent at the
start of class on recursive thinking. The first reading will then be Chapters 1 and
8, perhaps supplemented by additional recursive projects.
If the recursion is covered early, you may also proceed to cover binary search
(Section 11.1) and most of the sorting algorithms (Chapter 12) before introduc-
ing collection classes.
Supplements Via the Internet
The following materials are available to all readers of this text at cssup-
port.pearsoncmg.com (or alternatively at www.cs.colorado.edu/~main/
dsoj.html):
• Source code
• Errata
In addition, the following supplements are available to qualified instructors.
Visit Addison-Wesley’s Instructor Resource Center (www.aw.com/irc) or con-
tact your local Addison-Wesley representative for access to these:
• PowerPoint®
presentations
• Exam questions
• Solutions to selected programming projects
• Speaker notes
• Sample assignments
• Suggested syllabi
Preface xiii
Acknowledgments
This book grew from joint work with Walter Savitch, who continues to be an
ever-present and enthusiastic supporter, colleague, and friend. My students from
the University of Colorado at Boulder serve to provide inspiration and joy at
every turn, particularly the spring seminars in Natural Computing and Ideas in
Computing. During the past few years, the book has also been extensively
reviewed by J.D. Baker, Philip Barry, Arthur Crummer, Herbert Dershem, Greg
Dobbins, Zoran Duric, Dan Grecu, Scott Grissom, Bob Holloway, Rod Howell,
Danny Krizanc, Ran Libeskind-Hadas, Meiliu Lu, Catherine Matthews, Robert
Moll, Robert Pastel, Don Slater, Ryan Stansifer, Deborah Trytten, and John
Wegis. I thank these colleagues for their excellent critique and their encourage-
ment.
At Addison-Wesley, I thank Tracy Dunkelberger, Michael Hirsch, Bob
Engelhardt, and Stephanie Sellinger, who have provided continual support and
knowledgeable advice.
I also thank my friends and colleagues who have given me daily
encouragement and friendship during the writing of this fourth edition: Andrzej
Ehrenfeucht, Marga Powell, Grzegorz Rozenberg, and Allison Thompson-
Brown, and always my family: Janet, Tim, Hannah, Michelle, and Paul.
Michael Main (main@colorado.edu)
Boulder, Colorado
xiv Preface
Chapter 1 THE PHASES OF SOFTWARE DEVELOPMENT 1
Chapter 2 JAVA CLASSES AND INFORMATION HIDING 38
Chapter 3 COLLECTION CLASSES 103
Chapter 4 LINKED LISTS 175
Chapter 5 GENERIC PROGRAMMING 251
Chapter 6 STACKS 315
Chapter 7 QUEUES 360
Chapter 8 RECURSIVE THINKING 409
Chapter 9 TREES 453
Chapter 10 TREE PROJECTS 520
Chapter 11 SEARCHING 567
Chapter 12 SORTING 614
Chapter 13 SOFTWARE REUSE WITH EXTENDED CLASSES 675
Chapter 14 GRAPHS 728
APPENDIXES 775
INDEX 815
Chapter List
Contents xv
CHAPTER 1 THE PHASES OF SOFTWARE DEVELOPMENT 1
1.1 Specification, Design, Implementation 4
Design Technique: Decomposing the Problem 5
How to Write a Specification for a Java Method 6
Pitfall: Throw an Exception to Indicate a Failed Precondition 9
Temperature Conversion: Implementation 10
Programming Tip: Use Javadoc to Write Specifications 13
Programming Tip: Use Final Variables to Improve Clarity 13
Programming Tip: Make Exception Messages Informative 14
Programming Tip: Format Output with System.out.printf 14
Self-Test Exercises for Section 1.1 15
1.2 Running Time Analysis 16
The Stair-Counting Problem 16
Big-O Notation 21
Time Analysis of Java Methods 23
Worst-Case, Average-Case, and Best-Case Analyses 25
Self-Test Exercises for Section 1.2 26
1.3 Testing and Debugging 26
Choosing Test Data 27
Boundary Values 27
Fully Exercising Code 28
Pitfall: Avoid Impulsive Changes 29
Using a Debugger 29
Assert Statements 29
Turning Assert Statements On and Off 30
Programming Tip: Use a Separate Method for Complex Assertions 32
Pitfall: Avoid Using Assertions to Check Preconditions 34
Static Checking Tools 34
Self-Test Exercises for Section 1.3 34
Chapter Summary 35
Solutions to Self-Test Exercises 36
CHAPTER 2 JAVA CLASSES AND INFORMATION HIDING 38
2.1 Classes and Their Members 40
Defining a New Class 41
Instance Variables 41
Constructors 42
No-Arguments Constructors 43
Methods 43
Accessor Methods 44
Programming Tip: Four Reasons to Implement Accessor Methods 44
Pitfall: Division Throws Away the Fractional Part 45
Programming Tip: Use the Boolean Type for True or False Values 46
Modification Methods 46
Pitfall: Potential Arithmetic Overflows 48
Complete Definition of Throttle.java 48
Methods May Activate Other Methods 51
Self-Test Exercises for Section 2.1 51
Contents
Visit https://testbankfan.com
now to explore a rich
collection of testbank or
solution manual and enjoy
exciting offers!
xvi Contents
2.2 Using a Class 52
Creating and Using Objects 52
A Program with Several Throttle Objects 53
Null References 54
NullPointerException 55
Assignment Statements with Reference Variables 55
Clones 58
Testing for Equality 58
Terminology Controversy: “The Throttle That t Refers To” 59
Self-Test Exercises for Section 2.2 59
2.3 Packages 60
Declaring a Package 60
The Import Statement to Use a Package 63
The JCL Packages 63
More about Public, Private, and Package Access 63
Self-Test Exercises for Section 2.3 65
2.4 Parameters, Equals Methods, and Clones 65
The Location Class 66
Static Methods 72
Parameters That Are Objects 73
Methods May Access Private Instance Variables of Objects in Their Own Class 74
The Return Value of a Method May Be an Object 75
Programming Tip: How to Choose the Names of Methods 76
Java’s Object Type 77
Using and Implementing an Equals Method 77
Pitfall: ClassCastException 80
Every Class Has an Equals Method 80
Using and Implementing a Clone Method 81
Pitfall: Older Java Code Requires a Typecast for Clones 81
Programming Tip: Always Use super.clone for Your Clone Method 85
Programming Tip: When to Throw a Runtime Exception 85
A Demonstration Program for the Location Class 85
What Happens When a Parameter Is Changed Within a Method? 86
Self-Test Exercises for Section 2.4 89
2.5 The Java Class Libraries 90
Chapter Summary 92
Solutions to Self-Test Exercises 93
Programming Projects 95
Contents xvii
CHAPTER 3 COLLECTION CLASSES 103
3.1 A Review of Java Arrays 104
Pitfall: Exceptions That Arise from Arrays 106
The Length of an Array 106
Assignment Statements with Arrays 106
Clones of Arrays 107
The Arrays Utility Class 108
Array Parameters 110
Programming Tip: Enhanced For-Loops for Arrays 111
Self-Test Exercises for Section 3.1 112
3.2 An ADT for a Bag of Integers 113
The Bag ADT—Specification 114
OutOfMemoryError and Other Limitations for Collection Classes 118
The IntArrayBag Class—Specification 118
The IntArrayBag Class—Demonstration Program 122
The IntArrayBag Class—Design 125
The Invariant of an ADT 126
The IntArrayBag ADT—Implementation 127
Programming Tip: Cloning a Class That Contains an Array 136
The Bag ADT—Putting the Pieces Together 137
Programming Tip: Document the ADT Invariant in the Implementation File 141
The Bag ADT—Testing 141
Pitfall: An Object Can Be an Argument to Its Own Method 142
The Bag ADT—Analysis 142
Self-Test Exercises for Section 3.2 144
3.3 Programming Project: The Sequence ADT 145
The Sequence ADT—Specification 146
The Sequence ADT—Documentation 150
The Sequence ADT—Design 150
The Sequence ADT—Pseudocode for the Implementation 156
Self-Test Exercises for Section 3.3 158
3.4 Programming Project: The Polynomial 159
Self-Test Exercises for Section 3.4 162
3.5 The Java HashSet and Iterators 162
The HashSet Class 162
Some of the HashSet Members 162
Iterators 163
Pitfall: Do Not Access an Iterator’s next Item When hasNext Is False 164
Pitfall: Changing a Container Object Can Invalidate Its Iterator 164
Invalid Iterators 164
Self-Test Exercises for Section 3.5 165
Chapter Summary 165
Solutions to Self-Test Exercises 166
Programming Projects 169
xviii Contents
CHAPTER 4 LINKED LISTS 175
4.1 Fundamentals of Linked Lists 176
Declaring a Class for Nodes 177
Head Nodes, Tail Nodes 177
The Null Reference 178
Pitfall: NullPointerExceptions with Linked Lists 179
Self-Test Exercises for Section 4.1 179
4.2 Methods for Manipulating Nodes 179
Constructor for the Node Class 180
Getting and Setting the Data and Link of a Node 180
Public Versus Private Instance Variables 181
Adding a New Node at the Head of a Linked List 182
Removing a Node from the Head of a Linked List 183
Adding a New Node That Is Not at the Head 185
Removing a Node That Is Not at the Head 188
Pitfall: NullPointerExceptions with removeNodeAfter 191
Self-Test Exercises for Section 4.2 191
4.3 Manipulating an Entire Linked List 192
Computing the Length of a Linked List 193
Programming Tip: How to Traverse a Linked List 196
Pitfall: Forgetting to Test the Empty List 197
Searching for an Element in a Linked List 197
Finding a Node by Its Position in a Linked List 198
Copying a Linked List 200
A Second Copy Method, Returning Both Head and Tail References 204
Programming Tip: A Method Can Return an Array 205
Copying Part of a Linked List 206
Using Linked Lists 207
Self-Test Exercises for Section 4.3 214
4.4 The Bag ADT with a Linked List 215
Our Second Bag—Specification 215
The grab Method 219
Our Second Bag—Class Declaration 219
The Second Bag—Implementation 220
Programming Tip: Cloning a Class That Contains a Linked List 223
Programming Tip: How to Choose between Different Approaches 225
The Second Bag—Putting the Pieces Together 229
Self-Test Exercises for Section 4.4 232
4.5 Programming Project: The Sequence ADT with a Linked List 232
The Revised Sequence ADT—Design Suggestions 232
The Revised Sequence ADT—Clone Method 235
Self-Test Exercises for Section 4.5 238
4.6 Beyond Simple Linked Lists 239
Arrays Versus Linked Lists and Doubly Linked Lists 239
Dummy Nodes 240
Java’s List Classes 241
ListIterators 242
Making the Decision 243
Self-Test Exercises for Section 4.6 244
Chapter Summary 244
Solutions to Self-Test Exercises 245
Programming Projects 248
Contents xix
CHAPTER 5 GENERIC PROGRAMMING 251
5.1 Java’s Object Type and Wrapper Classes 252
Widening Conversions 253
Narrowing Conversions 254
Wrapper Classes 256
Autoboxing and Auto-Unboxing Conversions 256
Advantages and Disadvantages of Wrapper Objects 257
Self-Test Exercises for Section 5.1 257
5.2 Object Methods and Generic Methods 258
Object Methods 259
Generic Methods 259
Pitfall: Generic Method Restrictions 260
Self-Test Exercises for Section 5.2 261
5.3 Generic Classes 262
Writing a Generic Class 262
Using a Generic Class 262
Pitfall: Generic Class Restrictions 263
Details for Implementing a Generic Class 263
Creating an Array to Hold Elements of the Unknown Type 263
Retrieving E Objects from the Array 264
Warnings in Generic Code 264
Programming Tip: Suppressing Unchecked Warnings 265
Using ArrayBag as the Type of a Parameter or Return Value 266
Counting the Occurrences of an Object 266
The Collection Is Really a Collection of References to Objects 267
Set Unused References to Null 269
Steps for Converting a Collection Class to a Generic Class 269
Deep Clones for Collection Classes 271
Using the Bag of Objects 279
Details of the Story-Writing Program 282
Self-Test Exercises for Section 5.3 282
5.4 Generic Nodes 283
Nodes That Contain Object Data 283
Pitfall: Misuse of the equals Method 283
Other Collections That Use Linked Lists 285
Self-Test Exercises for Section 5.4 285
5.5 Interfaces and Iterators 286
Interfaces 286
How to Write a Class That Implements an Interface 287
Generic Interfaces and the Iterable Interface 287
How to Write a Generic Class That Implements a Generic Interface 288
The Lister Class 289
Pitfall: Don’t Change a List While an Iterator Is Being Used 291
The Comparable Generic Interface 292
Parameters That Use Interfaces 293
Using instanceof to Test Whether a Class Implements an Interface 294
The Cloneable Interface 295
Self-Test Exercises for Section 5.5 295
xx Contents
5.6 A Generic Bag Class That Implements the Iterable Interface (Optional Section) 296
Programming Tip: Enhanced For-Loops for the Iterable Interface 297
Implementing a Bag of Objects Using a Linked List and an Iterator 298
Programming Tip: External Iterators Versus Internal Iterators 298
Summary of the Four Bag Implementations 299
Self-Test Exercises for Section 5.6 299
5.7 The Java Collection Interface and Map Interface (Optional Section) 300
The Collection Interface 300
The Map Interface and the TreeMap Class 300
The TreeMap Class 302
The Word Counting Program 305
Self-Test Exercises for Section 5.7 306
Chapter Summary 309
Solutions to Self-Test Exercises 310
Programming Projects 312
CHAPTER 6 STACKS 315
6.1 Introduction to Stacks 316
The Stack Class—Specification 317
We Will Implement a Generic Stack 319
Programming Example: Reversing a Word 319
Self-Test Exercises for Section 6.1 320
6.2 Stack Applications 320
Programming Example: Balanced Parentheses 320
Programming Tip: The Switch Statement 324
Evaluating Arithmetic Expressions 325
Evaluating Arithmetic Expressions—Specification 325
Evaluating Arithmetic Expressions—Design 325
Implementation of the Evaluate Method 329
Evaluating Arithmetic Expressions—Testing and Analysis 333
Evaluating Arithmetic Expressions—Enhancements 334
Self-Test Exercises for Section 6.2 334
6.3 Implementations of the Stack ADT 335
Array Implementation of a Stack 335
Linked List Implementation of a Stack 341
Self-Test Exercises for Section 6.3 344
6.4 More Complex Stack Applications 345
Evaluating Postfix Expressions 345
Translating Infix to Postfix Notation 348
Using Precedence Rules in the Infix Expression 350
Correctness of the Conversion from Infix to Postfix 353
Self-Test Exercises for Section 6.4 354
Chapter Summary 354
Solutions to Self-Test Exercises 355
Programming Projects 356
Random documents with unrelated
content Scribd suggests to you:
diagnose her case exactly. So she ‘tanked up’ some more on that
brand of intoxicant. Since she was constantly drugging herself, the
natural resistance of her body was weakened, and she got a bad
cold. The cough scared her almost to death; or rather, the
consumption cure advertisements which she took to reading did; and
she spent a few dollars on the fake factory which turns out Dr. King’s
New Discovery. This proving worthless, she switched to Piso’s Cure
and added the hasheesh habit to alcoholism. By this time she had
acquired a fine, typical case of patent-medicine dyspepsia. That idea
never occurred to her, though. She next tried Dr. Miles’s Anti-Pain
Pills (more acetanilid), and finally decided—having read some
advertising literature on the subject—that she had cancer. And the
reason she was leaving you, Mrs. Clyde, was that she had decided to
go to a scoundrelly quack named Johnson who conducts a cancer
institute in Kansas City, where he fleeces unfortunates out of their
money on the pretense that he can cure cancer without the use of
the knife.”
“Can’t you stop her?” asked Mrs. Clyde anxiously.
“Oh, I’ve stopped her! You’ll find the remains of her patent
medicines in the ash-barrel. I flatter myself I’ve fixed her case.”
Grandma Sharpless gazed at him solemnly. “‘Any doctor who
claims to cure is a quack.’ Quotation from Dr. Strong,” she said.
“Nearly had me there,” admitted he. “Fortunately I didn’t use the
word ‘cure.’ It wasn’t a case of cure. It was a case of correcting a
stupid, disastrous little blunder in mathematics.”
“Mathematics, eh?” repeated Mr. Clyde. “Have you reached the
point where you treat disease by algebra, and triangulate a patient
for an operation?”
“Not quite that. But poor Maggie suffered all her troubles solely
through an error in figuring by an incompetent man. A year ago she
had trouble with her eyes. Instead of going to a good oculist she
went to one of these stores which offer examinations free, and take
it out in the price of the glasses. The examination is worth just what
free things usually are worth—or less. They sold her a pair of glasses
for two dollars. The glasses were figured out some fifty degrees
wrong, for her error of vision, which was very slight, anyway. The
nervous strain caused by the effort of the eyes to accommodate
themselves to the false glasses and, later, the accumulated mass of
drugs with which she’s been insulting her insides, are all that’s the
matter with Maggie.”
“That is, the glasses caused the headaches, and the patent
medicines the stomach derangement,” said Mr. Clyde.
“And the general break up, though the glasses may have started
both before the nostrums ever got in their evil work. Nowadays, the
wise doctor, having an obscure stomach trouble to deal with, in the
absence of other explanation, looks to the eyes. Eyestrain has a
most potent and far-reaching influence on digestion. I know of one
case of chronic dyspepsia, of a year’s standing, completely cured by
a change of eyeglasses.”
“As a financial proposition,” said Mr. Gormley, “your nurse must
have come out at the wrong end of the horn.”
“Decidedly,” confirmed the doctor. “She spent on patent medicines
about forty dollars. The cancer quack would have got at least a
hundred dollars out of her, not counting her railroad fare. Two
hundred dollars would be a fair estimate of her little health-excursion
among the quacks. Any good physician would have sent her to an
oculist, who would have fitted proper glasses and saved all that
expense and drugging. The entire bill for doctor, oculist, and glasses
might have been twenty-five dollars. Yet they defend patent
medicines on the ground that they’re the ‘poor man’s doctor.”
Mr. Gormley rose. “Poor man’s undertaker, rather,” he amended.
“Well, having sufficiently blackguarded my own business, I think I’ll
go. Here’s the whole thing summed up, as I see it. It pays to go to
the doctor first and the druggist afterward; not to the druggist first
and the doctor afterward.”
Dr. Strong walked over to the gate with him. On his return Mrs.
Clyde remarked:
“What an interesting, thoughtful man. Are most druggists like
that?”
“They’re not all philosophers of the trade, like Gormley,” said Dr.
Strong, “but they have to be pretty intelligent before they can pass
the Pharmaceutical Board in this state, and put out their colored
lights.”
“I’ve often meant to ask what the green and red lights in front of
a drug-store stand for,” said Mrs. Clyde. “What is their derivation?”
“Green is the official color of medical science,” explained the
doctor. “The green flag, you know, indicates the hospital corps in
war-time; and the degree of M.D. is signalized by a green hood in
academic functions.”
“And the red globe on the other side of the store: what does that
mean?”
“Danger,” replied Dr. Strong grimly.
“N
V.
THE MAGIC LENS
o good fairy had ever bestowed such a gift as this magic
lens,” said Dr. Strong, whisking Bettina up from her seat
by the window and setting her on his knee. “It was most
marvelously and delicately made, and furnished with a lightning-
quick intelligence of its own. Everything that went on around it, it
reported to its fortunate possessor as swiftly as thought flies through
that lively little brain of yours. It earned its owner’s livelihood for
him; it gave him three fourths of his enjoyments and amusements; it
laid before him the wonderful things done and being done all over
the world; it guided all his life. And all that it required was a little
reasonable care, and such consideration as a man would show to the
horse that worked for him.”
“At the beginning you said it wasn’t a fairytale,” accused Bettina,
with the gravity which five years considers befitting such an
occasion.
“Wait. Because the owner of the magic lens found that it obeyed
all his orders so readily and faithfully, he began to impose on it. He
made it work very hard when it was tired. He set tasks for it to
perform under very difficult conditions. At times when it should have
been resting, he compelled it to minister to his amusements. When
it complained, he made light of its trouble.”
“Could it speak?” inquired the little auditor.
“At least it had a way of making known its wants. In everything
which concerned itself it was keenly intelligent, and knew what was
good and bad for it, as well as what was good and bad for its
owner.”
“Couldn’t it stop working for him if he was so bad to it?”
“Only as an extreme measure. But presently, in this case, it
threatened to stop. So the owner took it to a cheap and poor repair-
shop, where the repairer put a little oil in it to make it go on
working. For a time it went on. Then, one morning, the owner woke
up and cried out with a terrible fear. For the magic light in the magic
lens was gone. So for that foolish man there was no work to do nor
play to enjoy. The world was blotted out for him. He could not know
what was going on about him, except by hearsay. No more was the
sky blue for him, or the trees green, or the flowers bright; and the
faces of his friends meant nothing. He had thrown away the most
beautiful and wonderful of all gifts. Because it is a gift bestowed on
nearly all of us, most of us forgot the wonder and the beauty of it.
So, Honorable Miss Twinkles, do you beware how you treat the
magic lens which is given to you.”
“To me?” cried the child; and then, with a little squeal of
comprehension: “Oh, I know! My eyes. That’s the magic lens. Isn’t
it?”
“What’s that about Bettykin’s eyes?” asked Mr. Clyde, who had
come in quietly, and had heard the finish of the allegory.
“I’ve been examining them,” explained Dr. Strong, “and the story
was reward of merit for her going through with it like a little soldier.”
“Examining her eyes? Any particular reason?” asked the father
anxiously.
“Very particular. Mrs. Clyde wishes to send her to kindergarten for
a year before she enters the public school. No child ought to begin
school without a thorough test of vision.”
“What did the test show in Bettykin’s case?”
“Nothing except the defects of heredity.”
“Heredity? My sight is pretty good; and Mrs. Clyde’s is still better.”
“You two are not the Cherub’s only ancestors, however,” smiled
the physician. “And you can hardly expect one or two generations to
recast as delicate a bit of mechanism as the eye, which has been
built up through millions of years of slow development. However,
despite the natural deficiencies, there’s no reason in Betty why she
shouldn’t start in at kindergarten next term, provided there isn’t any
in the kindergarten itself.”
Mr. Clyde studied the non-committal face of his “Chinese
physician,” as he was given to calling Dr. Strong since the latter had
undertaken to safeguard the health of his household on the Oriental
basis of being paid to keep the family well and sound. “Something is
wrong with the school,” he decided.
“Read what it says of itself in that first paragraph,” replied Dr.
Strong, handing him a rather pretentious little booklet.
In the prospectus of their “new and scientific kindergarten,” the
Misses Sarsfield warmly congratulated themselves and their
prospective pupils, primarily, upon the physical advantages of their
school building which included a large work-and-play room, “with
generous window space on all sides, and finished throughout in
pure, glazed white.” This description the head of the Clyde
household read over twice; then he stepped to the door to intercept
Mrs. Clyde’s mother who was passing by.
“Here, Grandma,” said he. “Our Chinese tyrant had diagnosed
something wrong with that first page. Do you discover any kink in
it?”
“Not I,” said Mrs. Sharpless, after reading it. “Nor in the place
itself. I called there yesterday. It is a beautiful room; everything as
shiny and clean as a pin.”
“Yesterday was cloudy,” observed the Health Master.
“It was. Yet there wasn’t a corner of the place that wasn’t flooded
with light,” declared Mrs. Sharpless.
“And on a clear day, with the sun pouring in from all sides and
being flashed back from those shiny, white walls, the unfortunate
inmates would be absolutely dazzled.”
“Do you mean to say that God’s pure sunlight can hurt any one?”
challenged Mrs. Sharpless, who was rather given to citing the Deity
as support for her own side of any question.
“Did you ever hear of snow-blindness?” countered the physician.
“I’ve seen it in the North,” said Mr. Clyde. “It’s not a pleasant thing
to see.”
“Glazed white walls would give a very fair imitation of snow-glare.
Too much light is as bad as too little. Those walls should be tinted.”
“Yet it says here,” said Mr. Clyde, referring to his circular, “that the
‘Misses Sarsfield will conduct their institution on the most improved
Froebelian principles.”
“Froebel was a great man and a wise one,” said Dr. Strong. “His
kindergarten system has revolutionized all teaching. But he lived
before the age of hygienic knowledge. I suppose that no other man
has wrought so much disaster to the human eye as he.”
“That’s a pretty broad statement, Strong,” objected Air. Clyde.
“Is it? Look at the evidence. North Germany is the place where
Froebel first developed his system. Seventy-five per cent of the
population are defective of vision. Even the American children of
North German immigrants show a distinct excess of eye defects.
You’ve seen the comic pictures representing Boston children as
wearing huge goggles?”
“Are you making an argument out of a funny-paper joke?” queried
Grandma Sharpless.
“Why not? It wouldn’t be a joke if it hadn’t some foundation in
fact. The kindergarten system got its start in America in Boston.
Boston has the worst eyesight of any American city; impaired vision
has even become hereditary there. To return to Germany: if you
want a shock, look up the records of suicides among school-children
there.”
“But surely that has no connection with the eyes.”
“Surely it has,” controverted Dr. Strong. “The eye is the most
nervous of all the organs; and nothing will break down the nervous
system in general more swiftly and surely than eye-strain. Even in
this country we are raising up a generation of neurasthenic
youngsters, largely from neglect of their eyes.”
“Still, we’ve got to educate our children,” said Mr. Clyde.
“And we’ve got to take the utmost precautions lest the education
cost more than it is worth, in acquired defects.”
“For my part,” announced Grandma Sharpless, “I believe in early
schooling and in children learning to be useful. At the Sarsfield
school there were little girls no older that Bettina, who were doing
needlework beautifully; fine needlework at that.”
“Fine needlework!” exploded Dr. Strong in a tone which Grandma
Sharpless afterwards described as “damnless swearing.”
“That’s enough! See here, Clyde. Betty goes to that kindergarten
only over my dead job.”
“Oh, well,” said Mr. Clyde, amazed at the quite unwonted
excitement which the other exhibited, “if you’re dealing in
ultimatums, I’ll drop out and leave the stricken field to Mrs. Clyde.
This kindergarten scheme is hers. Wait. I’ll bring her. I think she just
came in.”
“What am I to fight with you about, Dr. Strong?” asked Mrs. Clyde,
appearing at the door, a vision of trim prettiness in her furs and veil.
“Tom didn’t tell me the casus belli.”
“Nobody in this house,” said Dr. Strong appealing to her, “seems to
deem the human eye entitled to the slightest consideration. You’ve
never worn glasses; therefore you must have respected your own
eyesight enough to—”
He stopped abruptly and scowled into Mrs. Clyde’s smiling face.
“Well! what’s the matter?” she demanded. “You look as if you
were going to bite.”
“What are you looking cross-eyed for?” the Health Master shot at
her.
“I’m not! Oh, it’s this veil, I suppose.” She lifted the heavy polka-
dotted screen and tucked it over her hat. “There, that’s more
comfortable!”
“Is it!” said the physician with an emphasis of sardonicism. “You
surprise me by admitting that much. How long have you been
wearing that instrument of torture?”
“Oh, two hours. Perhaps three. But, Dr. Strong, it doesn’t hurt my
eyes at all.”
“Nor your head?”
“I have got a little headache,” she confessed. “To think that a
supposedly intelligent woman who has reached the age of—of—”
“Thirty-eight,” said she, laughing. “I’m not ashamed of it.”
“—Thirty-eight, without having to wear glasses, should deliberately
abuse her hard-working vision by distorting it! See here,” he
interrupted himself, “it’s quite evident that I haven’t been living up to
the terms of my employment. One of these evenings we’re going to
have in this household a short but sharp lecture and symposium on
eyes. I’ll give the lecture; and I suspect that this family will furnish
the symposium—of horrible examples. Where’s Julia? As she’s the
family Committee on School Conditions, I expect to get some
material from her, too. Meantime, Mrs. Clyde, no kindergarten for
Betty kin, if you please. Or, in any case, not that kindergarten.”
No further ocular demonstrations were made by Dr. Strong for
several days. Then, one evening, he came into the library where the
whole family was sitting. Grandma Sharpless, in the old-fashioned
rocker, next a stand from which an old-fashioned student-lamp
dispensed its benign rays, was holding up, with some degree of
effort, a rather heavy book to the line of her vision. Opposite her a
soft easychair contained Robin, other-wise Bobs, involuted like a
currant-worm after a dose of Paris green, and imaginatively
treading, with the feet of enchantment, virgin expanses of forest in
the wake of Mr. Stewart White.
Julia, alias “Junkum,” his twin, was struggling against the demon
of ill chance as embodied in a game of solitaire, far over in a dim
corner. Geography enchained the mind of eight-year-old Charles,
also his eyes, and apparently his nose, which was stuck far down
into the mapped page. Near him his father, with chin doubled down
over a stiff collar, was internally begging leave to differ with the
editorial opinions of his favorite paper; while Mrs. Clyde, under the
direct glare of a side-wall electric cluster, unshaded, was perusing a
glazed-paper magazine, which threw upon her face a strong
reflected light. Before the fire Bettykin was retailing to her most
intelligent doll the allegory of the Magic Lens.
Enter, upon this scene of domestic peace, the spirit of devastation
in the person of the Health Master.
“The horrible examples being now on exhibit,” he remarked from
the doorway, “our symposium on eyes will begin.”
“He says we’re a hor’ble example, Susan Nipper,” said Bettina
confidentially, to her doll.
“No, I apologize, Bettykin,” returned the doctor. “You’re the only
two sensible people in the room.”
Julia promptly rose, lifted the stand with her cards on it, carried it
to the center of the library, and planted it so that the central light fell
across it from a little behind her.
“One recruit to the side of common sense,” observed the
physician. “Next!”
“What’s wrong with me?” demanded Mr. Clyde, looking up.
“Newspaper print?”
“Newspaper print is an unavoidable evil, and by no means the
worst example of Gutenberg’s art. No; the trouble with you is that
your neck is so scrunched down into a tight collar as to shut off a
proper blood supply from your head. Don’t your eyes feel bungy?”
“A little. What am I going to do? I can’t sit around after dinner
with no collar on.”
“Sit up straight, then; stick your neck up out of your collar and
give it play. Emulate the attentive turtle! And you, Bobs, stop
imitating an anchovy. Uncurl! Uncurl!!”
With a sigh, Robin straightened himself out. “I was so
comfortable,” he complained.
“No, you weren’t. You were only absorbed. The veins on your
temples are fairly bulging. You might as well try to read standing on
your head. Get a straight-backed chair, and you’re all right. I’m glad
to see that you follow Grandma Sharpless’s good example in reading
by a student-lamp.”
“That’s my own lamp,” said Mrs. Sharpless. “Seventy years has at
least taught me how to read.”
“How, but not what,” answered the Health Master. “That’s a bad
book you’re reading.”
Grandma Sharpless achieved the proud athletic feat of bounding
from her chair without the perceptible movement of a muscle.
“Young man!” she exclaimed in a shaking voice, “do you know
what book that is?”
“I don’t care what book—”
“It is the Bible.”
“Is it? Well, Heaven inspired the writer, but not the printer. Text
such as that ought to be prohibited by law. Isn’t there a passage in
that Bible, ‘Having eyes, ye see not’?”
“Yes, there is,” snapped Mrs. Sharpless. “And my eyes have been
seeing and seeing straight for a good many more years than yours.”
“The more credit to them and the less to you, if you’ve maltreated
them with such sight-murdering print as that. Haven’t you another
Bible?”
Grandma Sharpless sat down again. “I have another,” she said,
“with large print; but it’s so heavy.”
“Prescription: one reading-stand. Now, Mrs. Clyde.”
The mother of the family looked up from her magazine with a
smile.
“You can’t say that I haven’t large print or a good light,” she said.
“The print is good, but the paper bad,” said the Health Master.
“Bad, that is, as you are holding it under a full, unqualified electric
light. In reading from glazed paper, which reflects like a mirror, you
should use a very modified light. In fact, I blame myself from not
having had all the electric globes frosted long since. Now, I’ve kept
the worst offender for the last.”
Charley detached his nose from his geography and looked up.
“That’s me, I suppose,” he remarked pessimistically and
ungrammatically. “I’m always coming in for something special. But I
can’t make anything out of these old maps without digging my face
down into ‘em.”
“That’s a true bill against the book concern which turns out such a
book, and the school board which permits its use. Charley, do you
know why Manny isn’t playing football this year?”
“Manny” was the oldest son of the family, then away at school.
“Mother wanted him not to, I suppose,” said the boy.
“No,” said Mrs. Clyde. “Dr. Strong persuaded me that the
development he would get out of the game would be worth the risk.”
“It was his eyes,” said the Health Master. “He is wearing glasses
this year and will probably wear them next. After that I hope he can
stop them. But his trouble is that he—or rather his teachers—abused
his eyes with just such outrageous demands as that geography of
yours. And while the eye responded then, it is demanding payment
now.”
“But a kid’s got to study, hasn’t he? Else he won’t keep up,” put in
Bobs, much interested.
“Not at the expense of the most important of his senses,” returned
the Health Master. “And never at night, at Charley’s age, or even
yours, Bobs.”
“Then he gets dropped from his classes,” objected Bobs.
“The more blame to his classes. Early learning is much too
expensive at the cost of eye-strain and consequent nerve-strain. If
we force a student in the early years to make too great demands on
his eyes, the chances are that he will develop some eye or nervous
trouble at sixteen or seventeen and lose far more time than he has
gained before, not reckoning the disastrous physical effects.”
“But if other children go ahead, ours must,” said Mrs. Clyde.
“Perhaps the others who go ahead now won’t keep ahead later.
There is a sentence in Wood and Woodruff’s textbook on the eye[1]
which every public-school teacher and every parent should learn by
heart. It runs like this: ‘That child will be happier and a better citizen
as well as a more successful man of affairs, who develops into a
fairly healthy, though imperfectly schooled animal at twenty, than if
he becomes a learned, neurasthenic asthenope at the same age.’”
[1] Commoner Diseases of the Eye, by Casey A. Wood and
Thomas A. Woodruff, pp. 418, 419.
“Antelope?” put in Bettina, who was getting weary of her exclusion
from the topic. “I’ve got a picture of that. It’s a little deer.”
“So are you, Toddles,” cried the doctor, seizing upon her with one
hand and Susan Nipper with the other, and setting one on each
shoulder, “and we’re going to keep those very bright twinklers of
yours just as fit’as possible, both to see and be seen.”
“But what of Charley and the twins?” asked Mr. Clyde.
“Everything right, so far. They’re healthy young animals and can
meet the ordinary demands of school life. But no more study at
night, for some years, for Charley; and no more, ever, of fine-printed
maps. Some day, Charley, you may go to the Orinoco. It’s a good
deal more desirable that you should be able to see what there is to
be seen there, then, than that you should learn, now, the name of
every infinitesimally designated town on its banks.”
“In my childhood,” observed Mrs. Sharpless, with the finality
proper to that classic introductory phrase, “we thought more of our
brains than our eyes.”
“An inverted principle. The brain can think for itself. The eye can
only complain, and not always very clearly in the case of a child.
Moreover, Mrs. Sharpless, in your school-days the eye wasn’t under
half the strain that it is in our modern, print-crowded world. The fact
is, we’ve made a tremendous leap forward, and radically changed a
habit and practice built up through hundreds and thousands of
years, and Nature is struggling against great difficulties to catch up
with us.”
“I don’t understand what you are getting at,” said Mrs. Clyde,
letting her magazine drop.
“Have you tried walking on all fours lately?” inquired the physician.
“Not for a number of years.”
“Presumably you would find it awkward. Yet if, through some
pressure of necessity, the human race should have to return to the
quadrupedal method, the alteration in life would be less radical than
we have imposed upon our vision in the last few generations.”
“Sounds like flat nonsense to me,” said the downright Clyde. “We
see just as all our ancestors saw.”
“Think again. Our ancestors, back a very few generations, were an
outdoor race living in a world of wide horizons. Their eyes could
range over far distances, unchecked, instead of being hemmed in
most of the time by four walls. They were farsighted. Indeed, their
survival depended upon their being far-sighted; like the animals
which they killed or which killed them, according as the human or
the beast had the best eyes. Nowadays, in order to live we must
read and write. That is, the primal demand upon the eye is that it
shall see keenly near at hand instead of far off. The whole hereditary
training of the organ has been inverted, as if a mountaineer should
be set to diving for pearls; and the poor thing hasn’t had time to
adjust itself yet. We employ our vision for close work ten times as
much as we did a hundred years ago and ten thousand times as
much as we did ten thousand years ago. But the influence of those
ten thousand years is still strong upon us, and the human child is
born with the eye of a savage or an animal.”
“What kind of an animal’s eyes have I got?” demanded Bettina. “A
antelope’s?”
“Almost as far-sighted,” returned the Health Master, wriggling out
from under her and catching her expertly as she fell. “And how do
you think an antelope would be doing fine needlework in a
kindergarten?”
“But, Strong, few of us go blind,” said Mr. Clyde. “And of those
who do, nearly half are needlessly so. That we aren’t all groping,
sightless, about the earth is due to the marvelous adaptability of our
eyes. And it is exactly upon that adaptability that we are so prone to
impose; working a willing horse to death. In the young the muscles
of accommodation, whereby the vision is focused, are almost
incredibly powerful; far more so than in the adult. The Cherub, here,
could force her vision to almost any kind of work and the eye would
not complain much—at this time. But later on the effects would be
manifest. Therefore we have to watch the eye very closely until it
begins to grow old, which is at about twelve years or so. In the adult
the eye very readily lets its owner know if anything is wrong. Only
fools disregard that warning. But in the developing years we must
see to it that those muscles, set to the task of overcoming
generations of custom, do not overwork and upset the whole
nervous organization. Sometimes glasses are necessary; usually,
only care.”
“In a few generations we’ll all have four eyes, won’t we?” asked
Bobs, making a pair of mock spectacles with his circled fingers and
thumbs.
“Oh, let’s hope not. The cartoonists of prophecy always give the
future man spectacles. But I believe that the tendency will be the
other way, and that, by evolution to meet new conditions, the eye
will fit itself for its work, unaided, in time. Meantime, we have to pay
the penalty of the change. That’s a small price for living in this
wonderful century.”
“You say that half the blind are needlessly so,” said Mrs. Clyde. “Is
that from preventable disease?”
“About forty per cent, of the wholly blind. But the half-blind and
the nervously wrecked victims of eye-strain owe their woes generally
to sheer carelessness and neglect. By the way, eye-strain itself may
cause very serious forms of disease, such as obstinate and
dangerous forms of indigestion, insomnia, or even St. Vitus’s dance
and epilepsy.”
“But you’re not telling us anything about eye diseases, Dr. Strong,”
said Julia.
“There speaks our Committee on School Conditions, filled full of
information,” said the Health Master with a smile. “Junkum has made
an important discovery, and made it in time. She has found that two
children recently transferred from Number 14 have red eyes.”
“Maybe they’ve been crying,” suggested Bettykin.
“They were when I saw them, acute Miss Twinkles, although they
didn’t mean it at all. One was crying out of one eye, and one out of
the other, which gave them a very curious, absurd, and interesting
appearance. They had each a developing case of pink-eye.”
“Horses have pink-eye, not people,” remarked Grandma Sharpless.
“To be more accurate, then, conjunctivitis. People have that; a
great many people, once it gets started. It looks very bad and
dangerous; but it isn’t if properly cared for. Only, it’s quite
contagious. Therefore the Committee on Schools, with myself as
acting executive, accomplished the temporary removal of those
children from school.”
“And then,” the Committee joyously took up the tale, “we went out
and trailed the pink-eye.”
“We did. We trailed it to its lair in School Number 14, and there we
found one of the most dangerous creatures which civilization still
allows to exist.”
“In the school?” said Bettykin. “Oo-oo! What was it?”
“It was a Rollertowl,” replied the doctor impressively and in a
sonorous voice.
“I never heard of it,” said the Cherub, awestruck. “What is it like?”
“He means a roller-towel, goosie,” explained Julia. “A towel on a
roller, that everybody wipes their hands and faces on.”
“Exactly. And because everybody uses it, any contagious disease
that anybody has, everybody is liable to catch. I’d as soon put a
rattlesnake in a school as a roller-towel. In this case, half the grade
where it was had conjunctivitis. But that isn’t the worst. There was
one case of trachoma in the grade; a poor little Italian whose
parents ignorantly sent her to an optician instead of an oculist. The
optician treated her for an ordinary inflammation, and now she will
lose the sight of one eye. Meantime, if any of the others have been
infected by her, through that roller-towel, there will be trouble, for
trachoma is a serious disease.”
“Did you throw out the roller-towel?” asked Charley with a hopeful
eye to a fray.
“No. We got thrown out ourselves, didn’t we, Junkum?”
“Pretty near,” corroborated Julia. “The principal told Dr. Strong that
he guessed he could run his school himself and he didn’t need any
interference by—by—what did he call us, Dr. Strong?”
“Interlopers. No, Cherub, an interloper is no relation to an
antelope. It was four days ago that we left that principal and went
out and whistled for the Fool-killer. Yesterday, the principal came
down with a rose-pink eye of his own; the Health Officer met him
and ordered him into quarantine, and the terrible and ferocious
Rollertowl is now writhing in its death-agonies on the ash-heap.”
“What about other diseases?” asked Mrs. Clyde after a pause.
“Nothing from me. The eye will report them itself quick enough.
And as soon as your eye tells you that anything is the matter with it,
you tell the oculist, and you’ll probably get along all right, as far as
diseases go. It is not diseases that I have to worry about, as your
Chinese-plan physician, so much as it is to see that you give your
vision a fair chance. Let’s see. Charley, you’re the Committee on Air,
aren’t you? Could you take on a little more work?”
“Try me,” said the boy promptly.
“All right; we’ll make you the Committee on Air and Light,
hereafter, with power of protest and report whenever you see your
mother going out in a polka-dotted, cross-eyed veil, or your
grandmother reading a Bible that needs burning worse than any
heretic ever did, or any of the others working or playing without
sufficient illumination. Here endeth this lecture, with a final word.
This is it:—
“The eye is the most nervous of all the body’s organs. Except in
early childhood, when it has the recklessness and overconfidence of
unbounded strength, it complains promptly and sharply of ill-usage.
Now, there are a few hundred rules about when and how to use the
eyes and when and how not to use them. I’m not going to burden
you with those. All I’m going to advise you is that when your eyes
burn, smart, itch, or feel strained, there’s some reason for it, and
you should obey the warning and stop urging them to work against
their protest. In fact, I might sum it all up in a motto which I think
I’ll hang here in the library—a terse old English slang phrase.”
“What is it?” asked Mr. Clyde.
“‘Mind your eye,’” replied the Health Master.
“O
VI.
THE RE-MADE LADY
f all unfortunate times!” lamented Mrs. Clyde, her piquant
face twisted to an expression of comic despair. “Why
couldn’t he have given us a little more notice?”
Impatiently she tossed aside the telegram which announced that
her husband’s old friend, Oren Taylor, the artist, would arrive at
seven o’clock that evening.
“Don’t let it bother you, dear,” said Clyde. “I’ll take him to the club
for dinner.”
“You can’t. Have you forgotten that I’ve invited Louise Ennis for
her quarterly—well—visitation?”
Clyde whistled. “That’s rather a poser. What business have I got to
have a cousin like Louise, anyway!”
Upon this disloyal observation Dr. Strong walked into the library.
He was a very different Dr. Strong from the nerve-shaken wanderer
who had dropped from nowhere into the Clyde household a year
previous as its physician on the Chinese plan of being employed to
keep the family well. The painful lines of the face were smoothed
out. There was a deep light of content, the content of the man who
has found his place and filled it, in the level eyes; and about the
grave and controlled set of the mouth a sort of sensitive buoyancy of
expression. The flesh had hardened and the spirit softened in him.
“Did you hear that, Strong?” inquired Mr. Clyde, turning to him.
“I have trained ears,” answered Dr. Strong solemnly. “They’re
absolutely impervious to any speech not intended for them.”
“Open them to this: Louise Ennis is invited for dinner to-night. So
is my old friend Oren Taylor, who wires to say that he’s passing
through town.”
“Is that Taylor, the artist of ‘The First Parting’? I shall enjoy
meeting him.”
“Well, you won’t enjoy meeting Cousin Louise,” declared Mr. Clyde.
“We ask her about four times a year, out of family piety. You’ve been
lucky to escape her thus far.”
“Rather a painful old party, your cousin?” inquired the physician,
smilingly, of Clyde.
“Old? Twenty-two,” said Mrs. Clyde. “But she looks fifty and feels a
hundred.”
“Allowing for feminine exaggeration,” amended Clyde.
“But what’s so wrong with her?” demanded the physician.
“Nerves,” said Mrs. Clyde.
“Stomach,” said Mr. Clyde.
“Headaches,” said Mrs. Clyde.
“Toe-aches,” said Mr. Clyde.
“Too much money,” said Mrs. Clyde.
“Too much ego,” said Mr. Clyde.
“Dyspepsia.”
“Hypochondria.”
“Chronic inertia.”
“Set it to music,” suggested Dr. Strong, “and sing it as a duet of
disease, from ablepsy to zymosis, inclusively. I shall be immensely
interested to observe this prodigy of ills.”
“You’ll have plenty of opportunity,” said Mrs. Clyde rather
maliciously. “You’re to sit next to her at dinner to-night.”
“Then put Bettykin on the other side of me,” he returned. “With
that combination of elf, tyrant, and angel close at hand, I can turn
for relief from the grave to the cradle.”
“Indeed you cannot. Louise can’t endure children. She says they
get on her nerves. My children!”
“Now you have put the finishing touch to your character sketch,”
observed Dr. Strong. “A woman of child-bearing age who can’t
endure children—well, she is pretty far awry.”
“Yet I can remember Louise when she was a sweet, attractive
young girl,” sighed Mrs. Clyde. “That was before her mother died,
and left her to the care of a father too busy making money to do
anything for his only child but spend it on her.”
“You’re talking about Lou Ennis, I know,” said Grandma Sharpless,
who had entered in time to hear the closing words.
“Yes,” said. Dr. Strong. “What is our expert diagnostician’s opinion
of the case? You know I always defer to you, ma’am, on any
problem that’s under the surface of things.”
“None of your soft sawder, young man!” said the old lady, her
shrewd, gray eyes twinkling from her shrewd, pink face. “My opinion
of Louise Ennis? I’ll give it to you in two words. Just spoiled.”
“Taking my warning as I find it,” remarked the physician, rising, “I
shall now retire to put on some chain armor under my evening coat,
in case the Terrible Cousin attempts to stab me with an oyster-fork.”
The dinner was not, as Mrs. Clyde was forced to admit afterward,
by any means the dismal function which she had anticipated. Oren
Taylor, an easy, discursive, humorous talker, set the pace and was
ably seconded by Grandma Sharpless, whose knack of incisive and
pointed comment served to spur him to his best. Dr. Strong, who
said little, attempted to draw Miss Ennis into the current of talk, and
was rewarded with an occasional flash of rather acid wit, which
caused the artist to look across the table curiously at the girl. So far
as he could do so without rudeness, the physician studied his
neighbor.
He saw a tall, amply-built girl, with a slackened frame whose
muscles had forgotten how to play their part properly in holding the
structure firm. Her face was flaccid. Under the large but dull eyes,
there was a bloodless puffiness. Discontent sat enthroned at the
corners of the sensitive mouth. A faint, reddish eruption disfigured
her chin. Her two strong assets, beautifully even teeth and a wealth
of soft, fine hair, failed wholly to save her from being a flatly
repellent woman. Dr. Strong noted further that her hands were
incessantly uneasy, and that she ate little and without interest. Also
she seemed, in a sullen way, shy. Yet, despite all of these
drawbacks, there was a pathetic suggestion of inherent fineness
about her; of qualities become decadent through disuse; a charm
that should have been, thwarted and perverted by a slovenly habit
of life. Dr. Strong set her down as a woman at war with herself, and
therefore with her world.
After dinner Mr. and Mrs. Clyde slipped away to see the children.
The artist followed Dr. Strong, to whom he had taken a liking, as
most men did, into the small lounging-room, where he lighted a
cigar.
“Too bad about that Miss Ennis, isn’t it?” said Taylor abruptly.
His companion looked at him interrogatively.
“Such a mess,” he continued. “Such a ruin. Yet so much left that
isn’t ruined. That face would be worth a lot to me for the ‘Poet’s
Cycle of the Months’ that I’m painting now. What a November she’d
make; ‘November, the withered mourner of glories dead and gone.’
Only I suppose she’d resent being asked to sit.”
“Illusions are the last assets that a woman loses,” agreed Dr.
Strong.
“To think,” pursued the painter, “of what her Maker meant her to
be, and of how she has belied it! She’s essentially and fundamentally
a beautiful woman; that is why I want her for a model.”
‘“In the structure of her face, perhaps—”
“Yes; and all through. Look at the set of her shoulders, and the
lines of her when she walks. Nothing jerry-built about her! She’s got
the contours of a goddess and the finish of a mud-pie. It’s
maddening.”
“More maddening from the physician’s point of view than from the
artist’s. For the physician knows how needless it all is.”
“Is she your patient?”
“If she were I’d be ashamed to admit it. Give me military authority
and a year’s time and if I couldn’t fix her so that she’d be proud to
pose for your picture—Good Heavens!”
From behind the drapery of the passageway appeared Louise
Ennis. She took two steps toward the two men and threw out her
hands in an appeal which was almost grotesque.
“Is it true?” she cried, turning from one to the other. “Tell me, is it
really true?”
“My dear young lady,” groaned Taylor, “what can I say to palliate
my unpard—”
“Nevermind that! I don’t care. I don’t care anything about it. It’s
my own fault. I stopped and listened. I couldn’t help it. It means so
much to me. You can’t know. No man can understand. Is it true that
I—that my face—”
Oren Taylor was an artist in more than his art: he possessed the
rare sense of the fit thing to do and say.
“It is true,” he answered quietly, “that I have seen few faces more
justly and beautifully modeled than yours.”
“And you,” she said, whirling upon Dr. Strong. “Can you do what
you said? Can you make me good-looking?”
“Not I. But you yourself can.”
“Oh, how? What must I do? D—d—don’t think me a fool!” She was
half-sobbing now. “It may be silly to long so bitterly to be beautiful.
But I’d give anything short of life for it.”
“Not silly at all,” returned Dr. Strong emphatically. “On the
contrary, that desire is rooted in the profoundest depths of sex.”
“And is the best excuse for art as a profession,” said the painter,
smiling.
“Only tell me what to do,” she besought. “Gently,” said Dr. Strong.
“It can’t be done in a day. And it will be a costly process.”
“That doesn’t matter. If money is all—”
“It isn’t all. It’s only a drop in the bucket. It will cost you dear in
comfort, in indulgence, in ease, in enjoyment, in habit—”
“I’ll obey like a child.” Again her hands went tremulously out to
him; then she covered her face with them and burst into the tears of
nervous exhaustion.
“This is no place for me,” said the artist, and was about to escape
by the door, when Mrs. Clyde blocked his departure.
“Ah, you are in here,” she said gayly. “I’d been wondering—Why,
what’s the matter? What is it?”
“There has been an unfortunate blunder,” said Dr. Strong quickly.
“I said some foolish things which Miss Ennis overheard—”
“No,” interrupted the painter. “The fault was mine—” And in the
same breath Louise Ennis cried:—
“I didn’t overhear! I listened. I eavesdropped.”
“Are you quite mad, all of you?” demanded the hostess. “Won’t
somebody tell me what has happened?”
“It’s true,” said the girl wildly; “every word they said. I am a
mess.”
Mrs. Clyde’s arms went around the girl. Sex-loyalty raised its war
signal flaring in her cheeks.
“Who said that?” she demanded, in a tone of which Dr. Strong
observed afterward, “I never before heard a woman roar under her
breath.”
“Never mind who said it,” retorted the girl. “It’s true anyway. It
wasn’t meant to hurt me. It didn’t hurt me. He is going to cure me;
Dr. Strong is.”
“Cure you, Louise? Of what?”
“Of ugliness. Of hideousness. Of being a mess.”
“But, my dear,” said the older woman softly, “you mustn’t take it to
heart so, the idle word of some one who doesn’t know you at all.”
“You can’t understand,” retorted the other passionately. “You’ve
always been pretty!”
“A compliment straight from the heart,” murmured the painter.
The color came into Mrs. Clyde’s smooth cheek again. “What have
you promised her, Dr. Strong?” she asked.
“Nothing. I have simply followed Mr. Taylor’s lead. His is the artist
eye that can see beauty beneath disguises. He has told Miss Ennis
that she was meant to be a beautiful woman. I have told her that
she can be what she was meant to be if she wills, and wills hard
enough.”
“And you will take charge of her case?” asked Mrs. Clyde.
“That, of course, depends upon you and Mr. Clyde. If you will
include Miss Ennis in the family, my responsibilities will automatically
extend to her.”
“Most certainly,” said Mrs. Clyde. “And now, Mr. Taylor,” she added,
answering a look of appeal from that uncomfortable gentleman,
“come and see the sketches. I really believe they are Whistler’s.”
As they left, Dr. Strong looked down at Louise Ennis with a smile.
“At present I prescribe a little cold water for those eyes,” said he.
“And then some general conversation in the drawing-room. Come
here tomorrow at four.”
“No,” said she. “I want to begin at once.”
“So as to profit by the impetus of the first enthusiasm? Very well.
How did you come here this evening?”
“In my limousine.”
“Sell it.”
“Sell my new car? At this time of year?”
“Store it, then.”
“And go about on street-cars, I suppose?”
“Not at all. Walk.”
“But when it rains?”
“Run.”
Eagerness died out of Louise Ennis’s face. “Oh, I know,” she said
pettishly. “It’s that old, old exercise treatment. Well, I’ve tried that,
and if you think—”
She stopped in surprise, for Dr. Strong, walking over to the door,
held the portière aside.
“After you,” he said courteously.
“Is that all the advice you have for me?” she persisted.
“After you,” he repeated.
“Well, I’m sorry,” she said sulkily. “What is it you want me—”
“Pardon me,” he interrupted in uncompromising tones. “I am sure
they are waiting for us in the other room.”
“You are treating me like a spoiled child,” declared Miss Ennis,
stamping a period to the charge with her high French heel.
“Precisely.”
She marched out of the room, and, with the physician, joined the
rest of the company. For the remainder of the evening she spoke
little to any one and not at all to Dr. Strong. But when she came to
say good-night he was standing apart. He held out his hand, which
she could not well avoid seeing.
“When you get up to-morrow,” he said, “look in the mirror, [she
winced] and say, ‘I can be beautiful if I want to hard enough.’ Good-
bye.”
Luncheon at the Clydes’ next day was given up to a family
discussion of Miss Louise Ennis, precipitated by Mr. Clyde, who rallied
Dr. Strong on his newest departure.
“Turned beauty doctor, have you?” he taunted good-humoredly.
“Trainer, rather,” answered Dr. Strong.
“You might be in better business,” declared Mrs. Sharpless, with
her customary frankness. “Beauty is only skin-deep.”
“Grandma Sharpless’s quotations,” remarked Dr. Strong to the
saltcellar, “are almost as sure to be wrong as her observations are to
be right.”
“It was a wiser man than you or I who spoke that truth about
beauty.”
“Nonsense! Beauty only skin-deep, indeed! It’s liver-deep anyway.
Often it’s soul-deep. Do you think you’ve kept your good looks,
Grandma Sharpless, just by washing your skin?”
“Don’t you try to dodge the issue by flattery, young man,” said the
old lady, the more brusquely in that she could see her son-in-law
grinning boyishly at the mounting color in her face. “I’m as the Lord
made me.”
“And as you’ve kept yourself, by clean, sound living. Miss Ennis
isn’t as the Lord made her or meant her. She’s a mere parody of it.
Her basic trouble is an ailment much more prevalent among
intelligent people than they are willing to admit. In the books it is
listed under various kinds of hyphenated neurosis; but it’s real name
is fool-in-the-head.”
“Curable?” inquired Mr. Clyde solicitously.
“There’s no known specific except removing the seat of the
trouble with an axe,” announced Dr. Strong. “But cases sometimes
respond to less heroic treatment.”
“Not this case, I fear,” put in Mrs. Clyde. “Louise will coddle herself
into the idea that you have grossly insulted her. She won’t come
back.”
“Won’t she!” exclaimed Mrs. Sharpless. “Insult or no insult, she
would come to the bait that Dr. Strong has thrown her if she had to
crawl on her knees.”
Come she did, prompt to the hour. From out the blustery February
day she lopped into the physician’s pleasant study, slumped into a
chair, and held out to him a limp left hand, palm up and fingers
curled. Ordinarily the most punctilious of men, Dr. Strong did not
move from his stance before the fire. He looked at the hand.
“What’s that for?” he inquired.
“Aren’t you going to feel my pulse?”
“No.”
“Nor take my temperature?”
“No.”
“Nor look at my tongue?”
“Certainly not. I have a quite sufficient idea of what it looks like.”
The tone was almost brutal. Miss Ennis began to whimper.
“I’m a m—m—mess, I know,” she blubbered. “But you needn’t
keep telling me so.”
“A mess can be cleared up,” said he more kindly, “under orders.”
“I’ll do whatever you tell me, if only—”
“Stop! There will be no ‘if’ about it. You will do as you are bid, or
we will drop the case right here.”
“No, no! Don’t drop me. I will. I promise. Only, please tell me
what is the matter with me.”
Dr. Strong, smiling inwardly, recalled the diagnosis he had
announced to the Clydes, but did not repeat it.
“Nothing,” he said.
“But I know there must be. I have such strange symptoms. You
can’t imagine.”
Fumbling in her hand-bag she produced a very elegant little
notebook with a gold pencil attached. Dr. Strong looked at it with
fascinated but ominous eyes.
“I’ve jotted down some of the symptoms here,” she continued,
“just as they occurred. You see, here’s Thursday. That was a heart
attack—”
“Let me see that book.”
She handed it to him. He carefully took the gold pencil from its
socket and returned it to her.
“Now, is there anything in this but symptoms? Any addresses that
you want to keep?”
“Only one: the address of a freckle and blemish remover.”
“We’ll come to that later. Meantime—” He tossed the book into the
heart of the coal fire where it promptly curled up and perished.
“Why—why—why—” gasped the visitor,—“how dare you? What do
you mean? That is an ivory-bound, gold-mounted book. It’s
valuable.”
“I told you, I believe, that the treatment would be expensive. This
is only the beginning. Of all outrageous, unforgivable kinds of self-
coddling, the hypochondria that keeps its own autobiography is the
worst.”
Regrettable though it is to chronicle, Miss Ennis hereupon emitted
a semi-yelp of rage and beat the floor with her high French heels.
Instantly the doctor’s gaze shifted to her feet. Just how it happened
she could not remember, but her right foot, unprotected, presently
hit the floor with a painful thump, while the physician contemplated
the shoe which he had deftly removed therefrom.
“Two inches and a half at least, that heel,” he observed. “Talk
about the Chinese women torturing their feet!” He laid the offending
article upon the hearth, set his own soundly shod foot upon it, and
tweaked off two inches of heel with the fire-tongs. “Not so pretty,”
he remarked, “but at least you can walk, and not tittup in that. Give
me the other.”
Shocked and astounded into helplessness, she mechanically
obeyed. He performed his rough-and-ready repairs, and handed it
back to her.
“Speaking of walking,” he said calmly, “have you stored your
automobile yet?”
“No! I—I—I—”
“After to-morrow I don’t want you to set foot in it. Now, then,
we’re going to put you through a course of questioning. Ready?”
Miss Ennis settled back in her chair, with the anticipatory
expression of one to whom the recital of her own woe is a lingering
pleasure. “Perhaps if I told you,” she began, “just how I feel—”
“Never mind that. Do you drink?”
“No!” The answer came back on the rebound. “Humph!” Dr. Strong
leaned over her. She turned her head away.
“You asked me as if you meant I was a drunkard,” she
complained. “Once in a while, when I have some severe nervous
strain to undergo, I need a stimulant.”
“Oh. Cocktail?”
“Yes. A mild one.”
“A mild cocktail! That’s a paradox I’ve never encountered. How
often do you take these mild cocktails?”
“Oh, just occasionally.”
“Well, a meal is an occasion. Before meals?”
“Sometimes,” she admitted reluctantly.
“You didn’t have one here last night.”
“No.”
“And you ate almost nothing.”
“That is just it, you see. I need something: otherwise I have no
appetite.”
“In other words, you have formed a drink habit.”
“Oh, Dr. Strong!” It was half reproach, half insulted innocence,
that wail.
“After a cocktail—or two—or three,” he looked at her closely, but
she would not meet his eyes, “you eat pretty well?”
“Yes, I suppose so.”
“And then go to bed with a headache because you’ve stimulated
your appetite to more food than your run-down mechanism can
rightly handle.”
“I do have a good many headaches.”
“Do anything for them?”
“Yes. I take some harmless powders, sometimes.”
“Harmless, eh? A harmless headache powder is like a mild
cocktail. It doesn’t exist. So you’re adding drug habit to drink habit.
Fortunately, it isn’t hard to stop. It has begun to show on you
already, in that puffy grayness under the eyes. All the coal-tar
powders vitiate the blood as well as affect the heart. Sleep badly?”
“Very often.”
“Take anything for that?”
“You mean opiates? I’m not a fool, Doctor.”
“You mean you haven’t gone quite that far,” said the other grimly.
“You’ve started in on two habits; but not the worst. Well, that’s all.
Come back when you need to.”
Miss Ennis’s big, dull eyes opened wide. “Aren’t you going to give
me anything? Any medicine?”
“You don’t need it.”
“Or any advice?”
Dr. Strong permitted himself a little smile at the success of his
strategy. “Give it to yourself,” he suggested. “You showed, in flashes,
during the dinner talk last night, that you have both wit and sense,
when you choose to use them. Do it now.”
The girl squirmed uncomfortably. “I suppose you want me to give
up cocktails,” she murmured in a die-away voice.
“Absolutely.”
“And try to get along with no stimulants at all?”
“By no means. Fresh air and exercise ad lib.”
“And to stop the headache powders?”
“Right; go on.”
“And to stop thinking about my symptoms?”
“Good! I didn’t reckon on your inherent sense in vain.”
“And to walk where I have been riding?”
“Rain or shine.”
“What about diet?”
“All the plain food you want, at any time you really want it,
provided you eat slowly and chew thoroughly.”
“A la Fletcher?”
“Horace Fletcher is one of those fine fanatics whose extravagances
correct the average man’s stolid stupidities. I’ve seen his fad made
ridiculous, but never harmful. Try it out.”
“And you won’t tell me when to come back?”
“When you need to, I said. The moment the temptation to break
over the rules becomes too strong, come. And—eh—by the way—eh
—don’t worry about your mirror for a while.” Temporarily content
with this, the new patient went away with new hope. Wiping his
brow, the doctor strolled into the sitting-room where he found the
family awaiting him with obvious but repressed curiosity.
“It isn’t ethical, I suppose,” said Mr. Clyde, “to discuss a patient’s
case with outsiders?”
“You’re not outsiders. And she’s not my patient, in the ordinary
sense, since I’m giving my services free. Moreover, I need all the
help I can get.”
“What can I do?” asked Mrs. Clyde promptly. “Drop in at her
house from time to time, and cheer her up. I don’t want her to
depend upon me exclusively. She has depended altogether too much
on doctors in the past.”
Mr. Clyde chuckled. “Did she tell you that the European medical
faculty had chased her around to every spa on the Continent?
Neurasthenic dyspepsia, they called it.”
“Pretty name! Seventy per cent of all dyspeptics have the seat of
the imagination in the stomach. The difficulty is to divert it.”
“What’s your plan?”
“Oh, I’ve several, when the time comes. For the present I’ve got
to get her around into condition.”
“Spoiled mind, spoiled body,” remarked Mrs. Sharpless.
“Exactly. And I’m going to begin on the body, because that is the
easiest to set right. Look out for an ill-tempered cousin during the
next fortnight.”
His prophecy was amply confirmed by Mrs. Clyde, who made it her
business, amid multifarious activities, to drop in upon Miss Ennis
with patient frequency. On the tenth day of the “cure,” Mrs. Clyde
reported to the household physician:—
“If I go there again I shall probably slap her. She’s become simply
unbearable.”
“Good!” said Dr. Strong. “Fine! She has had the nerve to stick to
the rules. We needn’t overstrain her, though. I’ll have her come here
tomorrow.”
Accordingly, at six o’clock in the evening of the eleventh day, the
patient stamped into the office, wet, bedraggled, and angry.
“Now look!” she cried. “You made me store my motor-car. All the
street-cars were crowded. My umbrella turned inside out. I’m a
perfect drench. And I know I’ll catch my death of cold.” Whereupon
she laid a pathetic hand on her chest and coughed hollowly.
“Stick out your foot,” ordered Dr. Strong. And, as she obeyed:
“That’s well. Good, sensible storm shoes. I’ll risk your taking cold.
How do you feel? Better?”
“No. Worse!” she snapped.
“I suppose so,” he retorted with a chuckle.
“What is more,” she declared savagely, “I look worse!”
“So your mirror has been failing in its mission of flattery. Too bad.
Now take off your coat, sit right there by the fire, and in an hour
you’ll be dry as toast.”
“An hour? I can’t stay an hour!”
“Why not?”
“It’s six o’clock. I must go home. Besides,” she added
unguardedly, “I’m half starved.”
“Indeed! Had a cocktail to-day?”
“No. Certainly not.”
“Yet you have an appetite. A bad sign. Oh, a very bad sign—for
the cocktail market.”
“I’m so tired all the time. And I wake up in the morning with
hardly any strength to get out of bed—”
“Or the inclination? Which?” broke in the doctor.
“And my heart gives the queerest jumps and—”
Welcome to our website – the ideal destination for book lovers and
knowledge seekers. With a mission to inspire endlessly, we offer a
vast collection of books, ranging from classic literary works to
specialized publications, self-development books, and children's
literature. Each book is a new journey of discovery, expanding
knowledge and enriching the soul of the reade
Our website is not just a platform for buying books, but a bridge
connecting readers to the timeless values of culture and wisdom. With
an elegant, user-friendly interface and an intelligent search system,
we are committed to providing a quick and convenient shopping
experience. Additionally, our special promotions and home delivery
services ensure that you save time and fully enjoy the joy of reading.
Let us accompany you on the journey of exploring knowledge and
personal growth!
ebookluna.com

More Related Content

PDF
Get Object Oriented Data Structures Using Java 4th Edition Dale free all chap...
zeniraadjou
 
PDF
Object Oriented Data Structures Using Java 4th Edition Dale
tasijatukula
 
PDF
C++ plus data structures, 3rd edition (2003)
SHC
 
PDF
Java Software Structures Designing And Using Data Structures 3rd Edition John...
phemilohana
 
PDF
Java How To Program Fourth Edition Harvey M. Deitel
timerokhobor
 
PDF
Java Foundations Introduction to Program Design and Data Structures (5th Edit...
hariomtapang
 
PDF
C Plus Data Structures Subsequent Dale Nell B
noyzdapat39
 
PPT
Java
Prabhat gangwar
 
Get Object Oriented Data Structures Using Java 4th Edition Dale free all chap...
zeniraadjou
 
Object Oriented Data Structures Using Java 4th Edition Dale
tasijatukula
 
C++ plus data structures, 3rd edition (2003)
SHC
 
Java Software Structures Designing And Using Data Structures 3rd Edition John...
phemilohana
 
Java How To Program Fourth Edition Harvey M. Deitel
timerokhobor
 
Java Foundations Introduction to Program Design and Data Structures (5th Edit...
hariomtapang
 
C Plus Data Structures Subsequent Dale Nell B
noyzdapat39
 

Similar to (eBook PDF) Data Structures and Other Objects Using Java 4th Edition (20)

PPT
Chap01
Jotham Gadot
 
PDF
OpenThink Labs Training : Diving into Java, The Head First Way
Wildan Maulana
 
PDF
MCA NOTES.pdf
RAJASEKHARV10
 
PPT
Topic5ClassDesignBestPPtFileForGCPANDALLCLOud.ppt
ASRPANDEY
 
PDF
Java Programming.pdf
IthagoniShirisha
 
PDF
Java Foundations Introduction To Program Design And Data Structures 2nd Editi...
eestissingar
 
PDF
Data Structures and Abstractions with Java 5th Edition Carrano Solutions Manual
AvaRosalessa
 
PPT
Core & advanced java classes in mumbai
Vibrant Technologies & Computers
 
PDF
(eBook PDF) Introduction to Programming with Java: A Problem Solving Approach...
linkyalsida
 
PDF
Java Fundamentals Of Computer Science Using Java
Prabhu vip
 
PDF
Hp syllabus
Nitish Nagar
 
PDF
M.c.a. (sem iv)- java programming
Praveen Chowdary
 
PPSX
Lecture 1
Shaista Qadir
 
PDF
(eBook PDF) Introduction to Programming with Java: A Problem Solving Approach...
chueyseipp1i
 
PDF
Objects First With Java A Practical Introduction Using Bluej 1st Edition Davi...
szirtmbondo
 
PPTX
ppt_on_java.pptx
MAYANKKUMAR492040
 
PDF
INTRODUCTION TO DATA STRUCTURES AND ALGORITHM
workspaceabhishekmah
 
PDF
INTRODUCTION TO DATA STRUCTURES AND ALGORITHMS
workspaceabhishekmah
 
PDF
(eBook PDF) Introduction to Programming with Java: A Problem Solving Approach...
lucotkioes
 
DOCX
OOP Lab-manual btech in cse kerala technological university
seenamt1234
 
Chap01
Jotham Gadot
 
OpenThink Labs Training : Diving into Java, The Head First Way
Wildan Maulana
 
MCA NOTES.pdf
RAJASEKHARV10
 
Topic5ClassDesignBestPPtFileForGCPANDALLCLOud.ppt
ASRPANDEY
 
Java Programming.pdf
IthagoniShirisha
 
Java Foundations Introduction To Program Design And Data Structures 2nd Editi...
eestissingar
 
Data Structures and Abstractions with Java 5th Edition Carrano Solutions Manual
AvaRosalessa
 
Core & advanced java classes in mumbai
Vibrant Technologies & Computers
 
(eBook PDF) Introduction to Programming with Java: A Problem Solving Approach...
linkyalsida
 
Java Fundamentals Of Computer Science Using Java
Prabhu vip
 
Hp syllabus
Nitish Nagar
 
M.c.a. (sem iv)- java programming
Praveen Chowdary
 
Lecture 1
Shaista Qadir
 
(eBook PDF) Introduction to Programming with Java: A Problem Solving Approach...
chueyseipp1i
 
Objects First With Java A Practical Introduction Using Bluej 1st Edition Davi...
szirtmbondo
 
ppt_on_java.pptx
MAYANKKUMAR492040
 
INTRODUCTION TO DATA STRUCTURES AND ALGORITHM
workspaceabhishekmah
 
INTRODUCTION TO DATA STRUCTURES AND ALGORITHMS
workspaceabhishekmah
 
(eBook PDF) Introduction to Programming with Java: A Problem Solving Approach...
lucotkioes
 
OOP Lab-manual btech in cse kerala technological university
seenamt1234
 
Ad

Recently uploaded (20)

PDF
PG-BPSDMP 2 TAHUN 2025PG-BPSDMP 2 TAHUN 2025.pdf
AshifaRamadhani
 
PPTX
An introduction to Prepositions for beginners.pptx
drsiddhantnagine
 
PDF
Review of Related Literature & Studies.pdf
Thelma Villaflores
 
PPTX
PPTs-The Rise of Empiresghhhhhhhh (1).pptx
academysrusti114
 
PDF
Electricity-Magnetic-and-Heating-Effects 4th Chapter/8th-science-curiosity.pd...
Sandeep Swamy
 
PPTX
Tips Management in Odoo 18 POS - Odoo Slides
Celine George
 
PDF
Phylum Arthropoda: Characteristics and Classification, Entomology Lecture
Miraj Khan
 
PDF
The Picture of Dorian Gray summary and depiction
opaliyahemel
 
PPTX
PREVENTIVE PEDIATRIC. pptx
AneetaSharma15
 
PPT
Python Programming Unit II Control Statements.ppt
CUO VEERANAN VEERANAN
 
PDF
Sunset Boulevard Student Revision Booklet
jpinnuck
 
PDF
The Minister of Tourism, Culture and Creative Arts, Abla Dzifa Gomashie has e...
nservice241
 
PPTX
Open Quiz Monsoon Mind Game Prelims.pptx
Sourav Kr Podder
 
DOCX
Action Plan_ARAL PROGRAM_ STAND ALONE SHS.docx
Levenmartlacuna1
 
PPTX
IMMUNIZATION PROGRAMME pptx
AneetaSharma15
 
PPTX
How to Manage Global Discount in Odoo 18 POS
Celine George
 
PPTX
NOI Hackathon - Summer Edition - GreenThumber.pptx
MartinaBurlando1
 
PPTX
Presentation on Janskhiya sthirata kosh.
Ms Usha Vadhel
 
PPTX
Understanding operators in c language.pptx
auteharshil95
 
PPTX
Odoo 18 Sales_ Managing Quotation Validity
Celine George
 
PG-BPSDMP 2 TAHUN 2025PG-BPSDMP 2 TAHUN 2025.pdf
AshifaRamadhani
 
An introduction to Prepositions for beginners.pptx
drsiddhantnagine
 
Review of Related Literature & Studies.pdf
Thelma Villaflores
 
PPTs-The Rise of Empiresghhhhhhhh (1).pptx
academysrusti114
 
Electricity-Magnetic-and-Heating-Effects 4th Chapter/8th-science-curiosity.pd...
Sandeep Swamy
 
Tips Management in Odoo 18 POS - Odoo Slides
Celine George
 
Phylum Arthropoda: Characteristics and Classification, Entomology Lecture
Miraj Khan
 
The Picture of Dorian Gray summary and depiction
opaliyahemel
 
PREVENTIVE PEDIATRIC. pptx
AneetaSharma15
 
Python Programming Unit II Control Statements.ppt
CUO VEERANAN VEERANAN
 
Sunset Boulevard Student Revision Booklet
jpinnuck
 
The Minister of Tourism, Culture and Creative Arts, Abla Dzifa Gomashie has e...
nservice241
 
Open Quiz Monsoon Mind Game Prelims.pptx
Sourav Kr Podder
 
Action Plan_ARAL PROGRAM_ STAND ALONE SHS.docx
Levenmartlacuna1
 
IMMUNIZATION PROGRAMME pptx
AneetaSharma15
 
How to Manage Global Discount in Odoo 18 POS
Celine George
 
NOI Hackathon - Summer Edition - GreenThumber.pptx
MartinaBurlando1
 
Presentation on Janskhiya sthirata kosh.
Ms Usha Vadhel
 
Understanding operators in c language.pptx
auteharshil95
 
Odoo 18 Sales_ Managing Quotation Validity
Celine George
 
Ad

(eBook PDF) Data Structures and Other Objects Using Java 4th Edition

  • 1. Read Anytime Anywhere Easy Ebook Downloads at ebookluna.com (eBook PDF) Data Structures and Other Objects Using Java 4th Edition https://ebookluna.com/product/ebook-pdf-data-structures-and- other-objects-using-java-4th-edition/ OR CLICK HERE DOWLOAD EBOOK Visit and Get More Ebook Downloads Instantly at https://ebookluna.com
  • 2. Instant digital products (PDF, ePub, MOBI) available Download now and explore formats that suit you... (eBook PDF) Data Structures and Problem Solving Using Java 4th Edition https://ebookluna.com/product/ebook-pdf-data-structures-and-problem- solving-using-java-4th-edition/ ebookluna.com (eBook PDF) Data Structures and Abstractions with Java 4th Edition https://ebookluna.com/product/ebook-pdf-data-structures-and- abstractions-with-java-4th-edition/ ebookluna.com (eBook PDF) Data Structures and Abstractions with Java 4th Global Edition https://ebookluna.com/product/ebook-pdf-data-structures-and- abstractions-with-java-4th-global-edition/ ebookluna.com (eBook PDF) Starting Out with Java: From Control Structures through Data Structures 4th Edition https://ebookluna.com/product/ebook-pdf-starting-out-with-java-from- control-structures-through-data-structures-4th-edition/ ebookluna.com
  • 3. Data Structures and Abstractions with Java 5th Edition (eBook PDF) https://ebookluna.com/product/data-structures-and-abstractions-with- java-5th-edition-ebook-pdf/ ebookluna.com (eBook PDF) Starting Out with Java: From Control Structures through Objects, 7th Edition https://ebookluna.com/product/ebook-pdf-starting-out-with-java-from- control-structures-through-objects-7th-edition/ ebookluna.com (eBook PDF) Starting Out with Java: From Control Structures through Data Structures 3rd Edition https://ebookluna.com/product/ebook-pdf-starting-out-with-java-from- control-structures-through-data-structures-3rd-edition/ ebookluna.com (eBook PDF) Introduction to JAVA Programming and Data Structures Comprehensive Version 11 https://ebookluna.com/product/ebook-pdf-introduction-to-java- programming-and-data-structures-comprehensive-version-11/ ebookluna.com (eBook PDF) Java Foundations: Introduction to Program Design and Data Structures 5th Edition https://ebookluna.com/product/ebook-pdf-java-foundations-introduction- to-program-design-and-data-structures-5th-edition/ ebookluna.com
  • 6. Preface vii each method is presented along with a precondition/postcondition contract that completely specifies the behavior of the method. At this level, it’s important for the students to realize that the specification is not tied to any particular choice of implementation techniques. In fact, this same specification may be used several times for several different implementations of the same data type. Step 3: Use the Data Type. With the specification in place, students can write small applications or applets to show the data type in use. These applications are based solely on the data type’s specification because we still have not tied down the implementation. Step 4: Select Appropriate Data Structures and Proceed to Design and Implement the Data Type. With a good abstract understanding of the data type, we can select an appropriate data structure, such as an array, a linked list of nodes, or a binary tree of nodes. For many of our data types, a first design and implementation will select a simple approach, such as an array. Later, we will redesign and reimplement the same data type with a more complicated underly- ing structure. Because we are using Java classes, an implementation of a data type will have the selected data structures (arrays, references to other objects, etc.) as private instance variables of the class. In my own teaching, I stress the necessity for a clear understanding of the rules that relate the private instance variables to the abstract notion of the data type. I require each student to write these rules in clear English sentences that are called the invariant of the abstract data type. Once the invariant is written, students can proceed to implementing various methods. The invariant helps in writing correct methods because of two facts: (a) Each method (except the constructors) knows that the invariant is true when the method begins its work; and (b) each method is responsible for ensuring that the invariant is again true when the method finishes. Step 5: Analyze the Implementation. Each implementation can be analyzed for correctness, flexibility, and time analysis of the operations (using big-O notation). Students have a particularly strong opportunity for these analyses when the same data type has been implemented in several different ways. Where Will the Students Be at the End of the Course? At the end of our course, students understand the data types inside out. They know how to use the data types and how to implement them in several ways. They know the practical effects of the different implementation choices. The students can reason about efficiency with a big-O analysis and can argue for the correctness of their implementations by referring to the invariant of the ADT.
  • 7. viii Preface the data types in this book are cut-down versions of the Java Class Libraries One of the lasting effects of the course is the specification, design, and imple- mentation experience. The improved ability to reason about programs is also important. But perhaps most important of all is the exposure to classes that are easily used in many situations. The students no longer have to write everything from scratch. We tell our students that someday they will be thinking about a problem, and they will suddenly realize that a large chunk of the work can be done with a bag, a stack, a queue, or some such. And this large chunk of work is work that they won’t have to do. Instead, they will pull out the bag or stack or queue that they wrote this semester—using it with no modifications. Or, more likely, they will use the familiar data type from a library of standard data types, such as the proposed Java Class Libraries. In fact, the behavior of some data types in this text is a cut-down version of the JCL, so when students take the step to the real JCL, they will be on familiar ground—from the standpoint of how to use the class and also having a knowledge of the considerations that went into building the class. Other Foundational Topics Throughout the course, we also lay a foundation for other aspects of “real pro- gramming,” with coverage of the following topics beyond the basic data struc- tures material. Object-Oriented Programming. The foundations of object-oriented pro- gramming are laid by giving students a strong understanding of Java classes. The important aspects of classes are covered early: the notion of a method, the separation into private and public members, the purpose of constructors, and a small exposure to cloning and testing for equality. This is primarily covered in Chapter 2, some of which can be skipped by students with a good exposure to Java classes in the CS1 course. Further aspects of classes are introduced when the classes first use dynamic arrays (Chapter 3). At this point, the need for a more sophisticated clone method is explained. Teaching this OOP method with the first use of dynamic memory has the effect of giving the students a concrete picture of how an instance vari- able is used as a reference to a dynamic object such as an array. Conceptually, the largest innovation of OOP is the software reuse that occurs via inheritance. There are certainly opportunities for introducing inheritance right from the start of a data structures course (such as implementing a set class as a descendant of a bag class). However, an early introduction may also result in students juggling too many new concepts at once, resulting in a weaker under- standing of the fundamental data structures. Therefore, in my own course, I intro- duce inheritance at the end as a vision of things to come. But the introduction to inheritance (Sections 13.1 and 13.2) could be covered as soon as classes are understood. With this in mind, some instructors may wish to cover Chapter 13 earlier, just before stacks and queues, so that stacks and queues can be derived from another class.
  • 8. Preface ix Another alternative is to identify students who already know the basics of classes. These students can carry out an inheritance project (such as the ecosys- tem of Section 13.3), while the rest of the students first learn about classes. Java Objects. The Java Object type lies at the base of all the other Java types—or at least almost all the other types. The eight primitive types are not Java objects, and for many students, the CS1 work has been primarily with the eight primitive types. Because of this, the first few data structures are collec- tions of primitive values, such as a bag of integers or a sequence of double num- bers. Iterators. Iterators are an important part of the Java Class Libraries, allowing a programmer to easily step through the elements in a collection class. The Iteratable interface is introduced in Chapter 5. Throughout the rest of the text, iterators are not directly used, although they provide a good opportunity for programming projects, such as using a stack to implement an iterator for a binary search tree (Chapter 9). Recursion. First-semester courses often introduce students to recursion. But many of the first-semester examples are tail recursion, where the final act of the method is the recursive call. This may have given students a misleading impres- sion that recursion is nothing more than a loop. Because of this, I prefer to avoid early use of tail recursion in a second-semester course. So, in our second-semester course, we emphasize recursive solutions that use more than tail recursion. The recursion chapter provides four examples along these lines. Two of the examples—generating random fractals and traversing a maze—are big hits with the students. The fractal example runs as a graphical applet, and although the maze example is text based, an adventurous student can convert it to a graphical applet. These recursion examples (Chapter 8) appear just before trees (Chapter 9) since it is within recursive tree algorithms that recursion becomes vital. However, instructors who desire more emphasis on recursion can move that topic forward, even before Chapter 2. In a course that has time for advanced tree projects (Chapter 10), we analyze the recursive tree algorithms, explaining the importance of keeping the trees balanced—both to improve worst-case performance and to avoid potential execution stack overflow. Searching and Sorting. Chapters 11 and 12 provide fundamental coverage of searching and sorting algorithms. The searching chapter reviews binary search of an ordered array, which many students will have seen before. Hash tables are also introduced in the search chapter by implementing a version of the JCL hash table and also a second hash table that uses chaining instead of open addressing. The sorting chapter reviews simple quadratic sorting methods, but the majority of the chapter focuses on faster algorithms: the recursive merge sort (with worst-case time of O(n log n)), Tony Hoare’s recursive quicksort (with average- time O(n log n)), and the tree-based heapsort (with worst-case time of O(n log n)).
  • 9. x Preface Advanced Projects, Including Concurrency The text offers good opportunities for optional projects that can be undertaken by a more advanced class or by students with a stronger background in a large class. Particular advanced projects include the following: • Interactive applet-based test programs for any of the data structures (out- lined in Appendix I). • Implementing an iterator for the sequence class (see Chapter 5 Program- ming Projects). • Writing a deep clone method for a collection class (see Chapter 5 Pro- gramming Projects). • Writing an applet version of an application program (such as the maze tra- versal in Section 8.2 or the ecosystem in Section 13.3). • Using a stack to build an iterator for the binary search tree (see Chapter 9 Programming Projects). • A priority queue implemented as an array of ordinary queues (Section 7.4) or implemented using a heap (Section 10.1). • A set class implemented with B-trees (Section 10.2). I have made a partic- ular effort on this project to provide sufficient information for students to implement the class without need of another text. Advanced students have successfully completed this project as independent work. • Projects to support concurrent sorting in the final section of Chapter 12. • An inheritance project, such as the ecosystem of Section 13.3. • A graph class and associated graph algorithms in Chapter 14. This is another case in which advanced students may do work on their own. Java Language Versions All the source code in the book has been tested to work correctly with Java 2 Standard Edition Version 7.0, including new features such as generics and new concurrency support. Information on all of the Java products from Sun Micro- systems is available at http://java.sun.com/products/index.html. Flexibility of Topic Ordering This book was written to give instructors latitude in reordering the material to meet the specific background of students or to add early emphasis to selected topics. The dependencies among the chapters are shown on the next page. A line joining two boxes indicates that the upper box should be covered before the lower box. Here are some suggested orderings of the material: Typical Course. Start with Chapters 1–9, skipping parts of Chapter 2 if the students have a prior background in Java classes. Most chapters can be covered in a week, but you may want more time for Chapter 4 (linked lists), Chapter 8 (recursion), or Chapter 9 (trees). Typically, I cover the material in 13 weeks,
  • 10. Preface xi Sections 5.5–5.7 The Java API Iterators Java collections Java maps Section 10.1 Heaps Sections 5.1–5.4 Generic programming Chapter 6 Stacks Chapter 7 Queues Chapter 9 Trees Chapter 13 Extended classes Section 10.2 B-trees Section 10.4 Detailed tree analysis Chapter 12 Sorting (Heapsort also needs Section 10.1) Chapter 1 Introduction Chapters 2–3 Classes Reference variables Collection classes Chapter 2 can be skipped by students with a good background in Java classes. Chapter 4 Linked lists Chapter 8 Recursion Section 11.1 Binary search Sec. 11.2–11.3 Hash tables (Also requires Chapter 5) At the start of the course, students should be comfortable writing application programs and using arrays in Java. Chapter 14 Graphs Chapter Dependencies The shaded boxes provide good opportunities for advanced work. Section 10.3 Java trees
  • 11. xii Preface including time for exams and extra time for linked lists and trees. Remaining weeks can be spent on a tree project from Chapter 10 or on binary search (Sec- tion 11.1) and sorting (Chapter 12). Heavy OOP Emphasis. If students will cover sorting and searching else- where, then there is time for a heavier emphasis on object-oriented program- ming. The first three chapters are covered in detail, and then derived classes (Section 13.1) are introduced. At this point, students can do an interesting OOP project, perhaps based on the ecosystem of Section 13.3. The basic data struc- tures (Chapters 4–7) are then covered, with the queue implemented as a derived class (Section 13.4). Finish up with recursion (Chapter 8) and trees (Chapter 9), placing special emphasis on recursive methods. Accelerated Course. Assign the first three chapters as independent reading in the first week and start with Chapter 4 (linked lists). This will leave two to three extra weeks at the end of the term so that students can spend more time on searching, sorting, and the advanced topics (shaded in the chapter dependencies list). I also have taught the course with further acceleration by spending no lecture time on stacks and queues (but assigning those chapters as reading). Early Recursion / Early Sorting. One to three weeks may be spent at the start of class on recursive thinking. The first reading will then be Chapters 1 and 8, perhaps supplemented by additional recursive projects. If the recursion is covered early, you may also proceed to cover binary search (Section 11.1) and most of the sorting algorithms (Chapter 12) before introduc- ing collection classes. Supplements Via the Internet The following materials are available to all readers of this text at cssup- port.pearsoncmg.com (or alternatively at www.cs.colorado.edu/~main/ dsoj.html): • Source code • Errata In addition, the following supplements are available to qualified instructors. Visit Addison-Wesley’s Instructor Resource Center (www.aw.com/irc) or con- tact your local Addison-Wesley representative for access to these: • PowerPoint® presentations • Exam questions • Solutions to selected programming projects • Speaker notes • Sample assignments • Suggested syllabi
  • 12. Preface xiii Acknowledgments This book grew from joint work with Walter Savitch, who continues to be an ever-present and enthusiastic supporter, colleague, and friend. My students from the University of Colorado at Boulder serve to provide inspiration and joy at every turn, particularly the spring seminars in Natural Computing and Ideas in Computing. During the past few years, the book has also been extensively reviewed by J.D. Baker, Philip Barry, Arthur Crummer, Herbert Dershem, Greg Dobbins, Zoran Duric, Dan Grecu, Scott Grissom, Bob Holloway, Rod Howell, Danny Krizanc, Ran Libeskind-Hadas, Meiliu Lu, Catherine Matthews, Robert Moll, Robert Pastel, Don Slater, Ryan Stansifer, Deborah Trytten, and John Wegis. I thank these colleagues for their excellent critique and their encourage- ment. At Addison-Wesley, I thank Tracy Dunkelberger, Michael Hirsch, Bob Engelhardt, and Stephanie Sellinger, who have provided continual support and knowledgeable advice. I also thank my friends and colleagues who have given me daily encouragement and friendship during the writing of this fourth edition: Andrzej Ehrenfeucht, Marga Powell, Grzegorz Rozenberg, and Allison Thompson- Brown, and always my family: Janet, Tim, Hannah, Michelle, and Paul. Michael Main ([email protected]) Boulder, Colorado
  • 13. xiv Preface Chapter 1 THE PHASES OF SOFTWARE DEVELOPMENT 1 Chapter 2 JAVA CLASSES AND INFORMATION HIDING 38 Chapter 3 COLLECTION CLASSES 103 Chapter 4 LINKED LISTS 175 Chapter 5 GENERIC PROGRAMMING 251 Chapter 6 STACKS 315 Chapter 7 QUEUES 360 Chapter 8 RECURSIVE THINKING 409 Chapter 9 TREES 453 Chapter 10 TREE PROJECTS 520 Chapter 11 SEARCHING 567 Chapter 12 SORTING 614 Chapter 13 SOFTWARE REUSE WITH EXTENDED CLASSES 675 Chapter 14 GRAPHS 728 APPENDIXES 775 INDEX 815 Chapter List
  • 14. Contents xv CHAPTER 1 THE PHASES OF SOFTWARE DEVELOPMENT 1 1.1 Specification, Design, Implementation 4 Design Technique: Decomposing the Problem 5 How to Write a Specification for a Java Method 6 Pitfall: Throw an Exception to Indicate a Failed Precondition 9 Temperature Conversion: Implementation 10 Programming Tip: Use Javadoc to Write Specifications 13 Programming Tip: Use Final Variables to Improve Clarity 13 Programming Tip: Make Exception Messages Informative 14 Programming Tip: Format Output with System.out.printf 14 Self-Test Exercises for Section 1.1 15 1.2 Running Time Analysis 16 The Stair-Counting Problem 16 Big-O Notation 21 Time Analysis of Java Methods 23 Worst-Case, Average-Case, and Best-Case Analyses 25 Self-Test Exercises for Section 1.2 26 1.3 Testing and Debugging 26 Choosing Test Data 27 Boundary Values 27 Fully Exercising Code 28 Pitfall: Avoid Impulsive Changes 29 Using a Debugger 29 Assert Statements 29 Turning Assert Statements On and Off 30 Programming Tip: Use a Separate Method for Complex Assertions 32 Pitfall: Avoid Using Assertions to Check Preconditions 34 Static Checking Tools 34 Self-Test Exercises for Section 1.3 34 Chapter Summary 35 Solutions to Self-Test Exercises 36 CHAPTER 2 JAVA CLASSES AND INFORMATION HIDING 38 2.1 Classes and Their Members 40 Defining a New Class 41 Instance Variables 41 Constructors 42 No-Arguments Constructors 43 Methods 43 Accessor Methods 44 Programming Tip: Four Reasons to Implement Accessor Methods 44 Pitfall: Division Throws Away the Fractional Part 45 Programming Tip: Use the Boolean Type for True or False Values 46 Modification Methods 46 Pitfall: Potential Arithmetic Overflows 48 Complete Definition of Throttle.java 48 Methods May Activate Other Methods 51 Self-Test Exercises for Section 2.1 51 Contents
  • 15. Visit https://testbankfan.com now to explore a rich collection of testbank or solution manual and enjoy exciting offers!
  • 16. xvi Contents 2.2 Using a Class 52 Creating and Using Objects 52 A Program with Several Throttle Objects 53 Null References 54 NullPointerException 55 Assignment Statements with Reference Variables 55 Clones 58 Testing for Equality 58 Terminology Controversy: “The Throttle That t Refers To” 59 Self-Test Exercises for Section 2.2 59 2.3 Packages 60 Declaring a Package 60 The Import Statement to Use a Package 63 The JCL Packages 63 More about Public, Private, and Package Access 63 Self-Test Exercises for Section 2.3 65 2.4 Parameters, Equals Methods, and Clones 65 The Location Class 66 Static Methods 72 Parameters That Are Objects 73 Methods May Access Private Instance Variables of Objects in Their Own Class 74 The Return Value of a Method May Be an Object 75 Programming Tip: How to Choose the Names of Methods 76 Java’s Object Type 77 Using and Implementing an Equals Method 77 Pitfall: ClassCastException 80 Every Class Has an Equals Method 80 Using and Implementing a Clone Method 81 Pitfall: Older Java Code Requires a Typecast for Clones 81 Programming Tip: Always Use super.clone for Your Clone Method 85 Programming Tip: When to Throw a Runtime Exception 85 A Demonstration Program for the Location Class 85 What Happens When a Parameter Is Changed Within a Method? 86 Self-Test Exercises for Section 2.4 89 2.5 The Java Class Libraries 90 Chapter Summary 92 Solutions to Self-Test Exercises 93 Programming Projects 95
  • 17. Contents xvii CHAPTER 3 COLLECTION CLASSES 103 3.1 A Review of Java Arrays 104 Pitfall: Exceptions That Arise from Arrays 106 The Length of an Array 106 Assignment Statements with Arrays 106 Clones of Arrays 107 The Arrays Utility Class 108 Array Parameters 110 Programming Tip: Enhanced For-Loops for Arrays 111 Self-Test Exercises for Section 3.1 112 3.2 An ADT for a Bag of Integers 113 The Bag ADT—Specification 114 OutOfMemoryError and Other Limitations for Collection Classes 118 The IntArrayBag Class—Specification 118 The IntArrayBag Class—Demonstration Program 122 The IntArrayBag Class—Design 125 The Invariant of an ADT 126 The IntArrayBag ADT—Implementation 127 Programming Tip: Cloning a Class That Contains an Array 136 The Bag ADT—Putting the Pieces Together 137 Programming Tip: Document the ADT Invariant in the Implementation File 141 The Bag ADT—Testing 141 Pitfall: An Object Can Be an Argument to Its Own Method 142 The Bag ADT—Analysis 142 Self-Test Exercises for Section 3.2 144 3.3 Programming Project: The Sequence ADT 145 The Sequence ADT—Specification 146 The Sequence ADT—Documentation 150 The Sequence ADT—Design 150 The Sequence ADT—Pseudocode for the Implementation 156 Self-Test Exercises for Section 3.3 158 3.4 Programming Project: The Polynomial 159 Self-Test Exercises for Section 3.4 162 3.5 The Java HashSet and Iterators 162 The HashSet Class 162 Some of the HashSet Members 162 Iterators 163 Pitfall: Do Not Access an Iterator’s next Item When hasNext Is False 164 Pitfall: Changing a Container Object Can Invalidate Its Iterator 164 Invalid Iterators 164 Self-Test Exercises for Section 3.5 165 Chapter Summary 165 Solutions to Self-Test Exercises 166 Programming Projects 169
  • 18. xviii Contents CHAPTER 4 LINKED LISTS 175 4.1 Fundamentals of Linked Lists 176 Declaring a Class for Nodes 177 Head Nodes, Tail Nodes 177 The Null Reference 178 Pitfall: NullPointerExceptions with Linked Lists 179 Self-Test Exercises for Section 4.1 179 4.2 Methods for Manipulating Nodes 179 Constructor for the Node Class 180 Getting and Setting the Data and Link of a Node 180 Public Versus Private Instance Variables 181 Adding a New Node at the Head of a Linked List 182 Removing a Node from the Head of a Linked List 183 Adding a New Node That Is Not at the Head 185 Removing a Node That Is Not at the Head 188 Pitfall: NullPointerExceptions with removeNodeAfter 191 Self-Test Exercises for Section 4.2 191 4.3 Manipulating an Entire Linked List 192 Computing the Length of a Linked List 193 Programming Tip: How to Traverse a Linked List 196 Pitfall: Forgetting to Test the Empty List 197 Searching for an Element in a Linked List 197 Finding a Node by Its Position in a Linked List 198 Copying a Linked List 200 A Second Copy Method, Returning Both Head and Tail References 204 Programming Tip: A Method Can Return an Array 205 Copying Part of a Linked List 206 Using Linked Lists 207 Self-Test Exercises for Section 4.3 214 4.4 The Bag ADT with a Linked List 215 Our Second Bag—Specification 215 The grab Method 219 Our Second Bag—Class Declaration 219 The Second Bag—Implementation 220 Programming Tip: Cloning a Class That Contains a Linked List 223 Programming Tip: How to Choose between Different Approaches 225 The Second Bag—Putting the Pieces Together 229 Self-Test Exercises for Section 4.4 232 4.5 Programming Project: The Sequence ADT with a Linked List 232 The Revised Sequence ADT—Design Suggestions 232 The Revised Sequence ADT—Clone Method 235 Self-Test Exercises for Section 4.5 238 4.6 Beyond Simple Linked Lists 239 Arrays Versus Linked Lists and Doubly Linked Lists 239 Dummy Nodes 240 Java’s List Classes 241 ListIterators 242 Making the Decision 243 Self-Test Exercises for Section 4.6 244 Chapter Summary 244 Solutions to Self-Test Exercises 245 Programming Projects 248
  • 19. Contents xix CHAPTER 5 GENERIC PROGRAMMING 251 5.1 Java’s Object Type and Wrapper Classes 252 Widening Conversions 253 Narrowing Conversions 254 Wrapper Classes 256 Autoboxing and Auto-Unboxing Conversions 256 Advantages and Disadvantages of Wrapper Objects 257 Self-Test Exercises for Section 5.1 257 5.2 Object Methods and Generic Methods 258 Object Methods 259 Generic Methods 259 Pitfall: Generic Method Restrictions 260 Self-Test Exercises for Section 5.2 261 5.3 Generic Classes 262 Writing a Generic Class 262 Using a Generic Class 262 Pitfall: Generic Class Restrictions 263 Details for Implementing a Generic Class 263 Creating an Array to Hold Elements of the Unknown Type 263 Retrieving E Objects from the Array 264 Warnings in Generic Code 264 Programming Tip: Suppressing Unchecked Warnings 265 Using ArrayBag as the Type of a Parameter or Return Value 266 Counting the Occurrences of an Object 266 The Collection Is Really a Collection of References to Objects 267 Set Unused References to Null 269 Steps for Converting a Collection Class to a Generic Class 269 Deep Clones for Collection Classes 271 Using the Bag of Objects 279 Details of the Story-Writing Program 282 Self-Test Exercises for Section 5.3 282 5.4 Generic Nodes 283 Nodes That Contain Object Data 283 Pitfall: Misuse of the equals Method 283 Other Collections That Use Linked Lists 285 Self-Test Exercises for Section 5.4 285 5.5 Interfaces and Iterators 286 Interfaces 286 How to Write a Class That Implements an Interface 287 Generic Interfaces and the Iterable Interface 287 How to Write a Generic Class That Implements a Generic Interface 288 The Lister Class 289 Pitfall: Don’t Change a List While an Iterator Is Being Used 291 The Comparable Generic Interface 292 Parameters That Use Interfaces 293 Using instanceof to Test Whether a Class Implements an Interface 294 The Cloneable Interface 295 Self-Test Exercises for Section 5.5 295
  • 20. xx Contents 5.6 A Generic Bag Class That Implements the Iterable Interface (Optional Section) 296 Programming Tip: Enhanced For-Loops for the Iterable Interface 297 Implementing a Bag of Objects Using a Linked List and an Iterator 298 Programming Tip: External Iterators Versus Internal Iterators 298 Summary of the Four Bag Implementations 299 Self-Test Exercises for Section 5.6 299 5.7 The Java Collection Interface and Map Interface (Optional Section) 300 The Collection Interface 300 The Map Interface and the TreeMap Class 300 The TreeMap Class 302 The Word Counting Program 305 Self-Test Exercises for Section 5.7 306 Chapter Summary 309 Solutions to Self-Test Exercises 310 Programming Projects 312 CHAPTER 6 STACKS 315 6.1 Introduction to Stacks 316 The Stack Class—Specification 317 We Will Implement a Generic Stack 319 Programming Example: Reversing a Word 319 Self-Test Exercises for Section 6.1 320 6.2 Stack Applications 320 Programming Example: Balanced Parentheses 320 Programming Tip: The Switch Statement 324 Evaluating Arithmetic Expressions 325 Evaluating Arithmetic Expressions—Specification 325 Evaluating Arithmetic Expressions—Design 325 Implementation of the Evaluate Method 329 Evaluating Arithmetic Expressions—Testing and Analysis 333 Evaluating Arithmetic Expressions—Enhancements 334 Self-Test Exercises for Section 6.2 334 6.3 Implementations of the Stack ADT 335 Array Implementation of a Stack 335 Linked List Implementation of a Stack 341 Self-Test Exercises for Section 6.3 344 6.4 More Complex Stack Applications 345 Evaluating Postfix Expressions 345 Translating Infix to Postfix Notation 348 Using Precedence Rules in the Infix Expression 350 Correctness of the Conversion from Infix to Postfix 353 Self-Test Exercises for Section 6.4 354 Chapter Summary 354 Solutions to Self-Test Exercises 355 Programming Projects 356
  • 21. Random documents with unrelated content Scribd suggests to you:
  • 22. diagnose her case exactly. So she ‘tanked up’ some more on that brand of intoxicant. Since she was constantly drugging herself, the natural resistance of her body was weakened, and she got a bad cold. The cough scared her almost to death; or rather, the consumption cure advertisements which she took to reading did; and she spent a few dollars on the fake factory which turns out Dr. King’s New Discovery. This proving worthless, she switched to Piso’s Cure and added the hasheesh habit to alcoholism. By this time she had acquired a fine, typical case of patent-medicine dyspepsia. That idea never occurred to her, though. She next tried Dr. Miles’s Anti-Pain Pills (more acetanilid), and finally decided—having read some advertising literature on the subject—that she had cancer. And the reason she was leaving you, Mrs. Clyde, was that she had decided to go to a scoundrelly quack named Johnson who conducts a cancer institute in Kansas City, where he fleeces unfortunates out of their money on the pretense that he can cure cancer without the use of the knife.” “Can’t you stop her?” asked Mrs. Clyde anxiously. “Oh, I’ve stopped her! You’ll find the remains of her patent medicines in the ash-barrel. I flatter myself I’ve fixed her case.” Grandma Sharpless gazed at him solemnly. “‘Any doctor who claims to cure is a quack.’ Quotation from Dr. Strong,” she said. “Nearly had me there,” admitted he. “Fortunately I didn’t use the word ‘cure.’ It wasn’t a case of cure. It was a case of correcting a stupid, disastrous little blunder in mathematics.” “Mathematics, eh?” repeated Mr. Clyde. “Have you reached the point where you treat disease by algebra, and triangulate a patient for an operation?” “Not quite that. But poor Maggie suffered all her troubles solely through an error in figuring by an incompetent man. A year ago she had trouble with her eyes. Instead of going to a good oculist she went to one of these stores which offer examinations free, and take it out in the price of the glasses. The examination is worth just what free things usually are worth—or less. They sold her a pair of glasses
  • 23. for two dollars. The glasses were figured out some fifty degrees wrong, for her error of vision, which was very slight, anyway. The nervous strain caused by the effort of the eyes to accommodate themselves to the false glasses and, later, the accumulated mass of drugs with which she’s been insulting her insides, are all that’s the matter with Maggie.” “That is, the glasses caused the headaches, and the patent medicines the stomach derangement,” said Mr. Clyde. “And the general break up, though the glasses may have started both before the nostrums ever got in their evil work. Nowadays, the wise doctor, having an obscure stomach trouble to deal with, in the absence of other explanation, looks to the eyes. Eyestrain has a most potent and far-reaching influence on digestion. I know of one case of chronic dyspepsia, of a year’s standing, completely cured by a change of eyeglasses.” “As a financial proposition,” said Mr. Gormley, “your nurse must have come out at the wrong end of the horn.” “Decidedly,” confirmed the doctor. “She spent on patent medicines about forty dollars. The cancer quack would have got at least a hundred dollars out of her, not counting her railroad fare. Two hundred dollars would be a fair estimate of her little health-excursion among the quacks. Any good physician would have sent her to an oculist, who would have fitted proper glasses and saved all that expense and drugging. The entire bill for doctor, oculist, and glasses might have been twenty-five dollars. Yet they defend patent medicines on the ground that they’re the ‘poor man’s doctor.” Mr. Gormley rose. “Poor man’s undertaker, rather,” he amended. “Well, having sufficiently blackguarded my own business, I think I’ll go. Here’s the whole thing summed up, as I see it. It pays to go to the doctor first and the druggist afterward; not to the druggist first and the doctor afterward.” Dr. Strong walked over to the gate with him. On his return Mrs. Clyde remarked:
  • 24. “What an interesting, thoughtful man. Are most druggists like that?” “They’re not all philosophers of the trade, like Gormley,” said Dr. Strong, “but they have to be pretty intelligent before they can pass the Pharmaceutical Board in this state, and put out their colored lights.” “I’ve often meant to ask what the green and red lights in front of a drug-store stand for,” said Mrs. Clyde. “What is their derivation?” “Green is the official color of medical science,” explained the doctor. “The green flag, you know, indicates the hospital corps in war-time; and the degree of M.D. is signalized by a green hood in academic functions.” “And the red globe on the other side of the store: what does that mean?” “Danger,” replied Dr. Strong grimly.
  • 25. “N V. THE MAGIC LENS o good fairy had ever bestowed such a gift as this magic lens,” said Dr. Strong, whisking Bettina up from her seat by the window and setting her on his knee. “It was most marvelously and delicately made, and furnished with a lightning- quick intelligence of its own. Everything that went on around it, it reported to its fortunate possessor as swiftly as thought flies through that lively little brain of yours. It earned its owner’s livelihood for him; it gave him three fourths of his enjoyments and amusements; it laid before him the wonderful things done and being done all over the world; it guided all his life. And all that it required was a little reasonable care, and such consideration as a man would show to the horse that worked for him.” “At the beginning you said it wasn’t a fairytale,” accused Bettina, with the gravity which five years considers befitting such an occasion. “Wait. Because the owner of the magic lens found that it obeyed all his orders so readily and faithfully, he began to impose on it. He made it work very hard when it was tired. He set tasks for it to perform under very difficult conditions. At times when it should have been resting, he compelled it to minister to his amusements. When it complained, he made light of its trouble.” “Could it speak?” inquired the little auditor. “At least it had a way of making known its wants. In everything which concerned itself it was keenly intelligent, and knew what was
  • 26. good and bad for it, as well as what was good and bad for its owner.” “Couldn’t it stop working for him if he was so bad to it?” “Only as an extreme measure. But presently, in this case, it threatened to stop. So the owner took it to a cheap and poor repair- shop, where the repairer put a little oil in it to make it go on working. For a time it went on. Then, one morning, the owner woke up and cried out with a terrible fear. For the magic light in the magic lens was gone. So for that foolish man there was no work to do nor play to enjoy. The world was blotted out for him. He could not know what was going on about him, except by hearsay. No more was the sky blue for him, or the trees green, or the flowers bright; and the faces of his friends meant nothing. He had thrown away the most beautiful and wonderful of all gifts. Because it is a gift bestowed on nearly all of us, most of us forgot the wonder and the beauty of it. So, Honorable Miss Twinkles, do you beware how you treat the magic lens which is given to you.” “To me?” cried the child; and then, with a little squeal of comprehension: “Oh, I know! My eyes. That’s the magic lens. Isn’t it?” “What’s that about Bettykin’s eyes?” asked Mr. Clyde, who had come in quietly, and had heard the finish of the allegory. “I’ve been examining them,” explained Dr. Strong, “and the story was reward of merit for her going through with it like a little soldier.” “Examining her eyes? Any particular reason?” asked the father anxiously. “Very particular. Mrs. Clyde wishes to send her to kindergarten for a year before she enters the public school. No child ought to begin school without a thorough test of vision.” “What did the test show in Bettykin’s case?” “Nothing except the defects of heredity.” “Heredity? My sight is pretty good; and Mrs. Clyde’s is still better.”
  • 27. “You two are not the Cherub’s only ancestors, however,” smiled the physician. “And you can hardly expect one or two generations to recast as delicate a bit of mechanism as the eye, which has been built up through millions of years of slow development. However, despite the natural deficiencies, there’s no reason in Betty why she shouldn’t start in at kindergarten next term, provided there isn’t any in the kindergarten itself.” Mr. Clyde studied the non-committal face of his “Chinese physician,” as he was given to calling Dr. Strong since the latter had undertaken to safeguard the health of his household on the Oriental basis of being paid to keep the family well and sound. “Something is wrong with the school,” he decided. “Read what it says of itself in that first paragraph,” replied Dr. Strong, handing him a rather pretentious little booklet. In the prospectus of their “new and scientific kindergarten,” the Misses Sarsfield warmly congratulated themselves and their prospective pupils, primarily, upon the physical advantages of their school building which included a large work-and-play room, “with generous window space on all sides, and finished throughout in pure, glazed white.” This description the head of the Clyde household read over twice; then he stepped to the door to intercept Mrs. Clyde’s mother who was passing by. “Here, Grandma,” said he. “Our Chinese tyrant had diagnosed something wrong with that first page. Do you discover any kink in it?” “Not I,” said Mrs. Sharpless, after reading it. “Nor in the place itself. I called there yesterday. It is a beautiful room; everything as shiny and clean as a pin.” “Yesterday was cloudy,” observed the Health Master. “It was. Yet there wasn’t a corner of the place that wasn’t flooded with light,” declared Mrs. Sharpless. “And on a clear day, with the sun pouring in from all sides and being flashed back from those shiny, white walls, the unfortunate inmates would be absolutely dazzled.”
  • 28. “Do you mean to say that God’s pure sunlight can hurt any one?” challenged Mrs. Sharpless, who was rather given to citing the Deity as support for her own side of any question. “Did you ever hear of snow-blindness?” countered the physician. “I’ve seen it in the North,” said Mr. Clyde. “It’s not a pleasant thing to see.” “Glazed white walls would give a very fair imitation of snow-glare. Too much light is as bad as too little. Those walls should be tinted.” “Yet it says here,” said Mr. Clyde, referring to his circular, “that the ‘Misses Sarsfield will conduct their institution on the most improved Froebelian principles.” “Froebel was a great man and a wise one,” said Dr. Strong. “His kindergarten system has revolutionized all teaching. But he lived before the age of hygienic knowledge. I suppose that no other man has wrought so much disaster to the human eye as he.” “That’s a pretty broad statement, Strong,” objected Air. Clyde. “Is it? Look at the evidence. North Germany is the place where Froebel first developed his system. Seventy-five per cent of the population are defective of vision. Even the American children of North German immigrants show a distinct excess of eye defects. You’ve seen the comic pictures representing Boston children as wearing huge goggles?” “Are you making an argument out of a funny-paper joke?” queried Grandma Sharpless. “Why not? It wouldn’t be a joke if it hadn’t some foundation in fact. The kindergarten system got its start in America in Boston. Boston has the worst eyesight of any American city; impaired vision has even become hereditary there. To return to Germany: if you want a shock, look up the records of suicides among school-children there.” “But surely that has no connection with the eyes.” “Surely it has,” controverted Dr. Strong. “The eye is the most nervous of all the organs; and nothing will break down the nervous
  • 29. system in general more swiftly and surely than eye-strain. Even in this country we are raising up a generation of neurasthenic youngsters, largely from neglect of their eyes.” “Still, we’ve got to educate our children,” said Mr. Clyde. “And we’ve got to take the utmost precautions lest the education cost more than it is worth, in acquired defects.” “For my part,” announced Grandma Sharpless, “I believe in early schooling and in children learning to be useful. At the Sarsfield school there were little girls no older that Bettina, who were doing needlework beautifully; fine needlework at that.” “Fine needlework!” exploded Dr. Strong in a tone which Grandma Sharpless afterwards described as “damnless swearing.” “That’s enough! See here, Clyde. Betty goes to that kindergarten only over my dead job.” “Oh, well,” said Mr. Clyde, amazed at the quite unwonted excitement which the other exhibited, “if you’re dealing in ultimatums, I’ll drop out and leave the stricken field to Mrs. Clyde. This kindergarten scheme is hers. Wait. I’ll bring her. I think she just came in.” “What am I to fight with you about, Dr. Strong?” asked Mrs. Clyde, appearing at the door, a vision of trim prettiness in her furs and veil. “Tom didn’t tell me the casus belli.” “Nobody in this house,” said Dr. Strong appealing to her, “seems to deem the human eye entitled to the slightest consideration. You’ve never worn glasses; therefore you must have respected your own eyesight enough to—” He stopped abruptly and scowled into Mrs. Clyde’s smiling face. “Well! what’s the matter?” she demanded. “You look as if you were going to bite.” “What are you looking cross-eyed for?” the Health Master shot at her. “I’m not! Oh, it’s this veil, I suppose.” She lifted the heavy polka- dotted screen and tucked it over her hat. “There, that’s more
  • 30. comfortable!” “Is it!” said the physician with an emphasis of sardonicism. “You surprise me by admitting that much. How long have you been wearing that instrument of torture?” “Oh, two hours. Perhaps three. But, Dr. Strong, it doesn’t hurt my eyes at all.” “Nor your head?” “I have got a little headache,” she confessed. “To think that a supposedly intelligent woman who has reached the age of—of—” “Thirty-eight,” said she, laughing. “I’m not ashamed of it.” “—Thirty-eight, without having to wear glasses, should deliberately abuse her hard-working vision by distorting it! See here,” he interrupted himself, “it’s quite evident that I haven’t been living up to the terms of my employment. One of these evenings we’re going to have in this household a short but sharp lecture and symposium on eyes. I’ll give the lecture; and I suspect that this family will furnish the symposium—of horrible examples. Where’s Julia? As she’s the family Committee on School Conditions, I expect to get some material from her, too. Meantime, Mrs. Clyde, no kindergarten for Betty kin, if you please. Or, in any case, not that kindergarten.” No further ocular demonstrations were made by Dr. Strong for several days. Then, one evening, he came into the library where the whole family was sitting. Grandma Sharpless, in the old-fashioned rocker, next a stand from which an old-fashioned student-lamp dispensed its benign rays, was holding up, with some degree of effort, a rather heavy book to the line of her vision. Opposite her a soft easychair contained Robin, other-wise Bobs, involuted like a currant-worm after a dose of Paris green, and imaginatively treading, with the feet of enchantment, virgin expanses of forest in the wake of Mr. Stewart White. Julia, alias “Junkum,” his twin, was struggling against the demon of ill chance as embodied in a game of solitaire, far over in a dim corner. Geography enchained the mind of eight-year-old Charles, also his eyes, and apparently his nose, which was stuck far down
  • 31. into the mapped page. Near him his father, with chin doubled down over a stiff collar, was internally begging leave to differ with the editorial opinions of his favorite paper; while Mrs. Clyde, under the direct glare of a side-wall electric cluster, unshaded, was perusing a glazed-paper magazine, which threw upon her face a strong reflected light. Before the fire Bettykin was retailing to her most intelligent doll the allegory of the Magic Lens. Enter, upon this scene of domestic peace, the spirit of devastation in the person of the Health Master. “The horrible examples being now on exhibit,” he remarked from the doorway, “our symposium on eyes will begin.” “He says we’re a hor’ble example, Susan Nipper,” said Bettina confidentially, to her doll. “No, I apologize, Bettykin,” returned the doctor. “You’re the only two sensible people in the room.” Julia promptly rose, lifted the stand with her cards on it, carried it to the center of the library, and planted it so that the central light fell across it from a little behind her. “One recruit to the side of common sense,” observed the physician. “Next!” “What’s wrong with me?” demanded Mr. Clyde, looking up. “Newspaper print?” “Newspaper print is an unavoidable evil, and by no means the worst example of Gutenberg’s art. No; the trouble with you is that your neck is so scrunched down into a tight collar as to shut off a proper blood supply from your head. Don’t your eyes feel bungy?” “A little. What am I going to do? I can’t sit around after dinner with no collar on.” “Sit up straight, then; stick your neck up out of your collar and give it play. Emulate the attentive turtle! And you, Bobs, stop imitating an anchovy. Uncurl! Uncurl!!” With a sigh, Robin straightened himself out. “I was so comfortable,” he complained.
  • 32. “No, you weren’t. You were only absorbed. The veins on your temples are fairly bulging. You might as well try to read standing on your head. Get a straight-backed chair, and you’re all right. I’m glad to see that you follow Grandma Sharpless’s good example in reading by a student-lamp.” “That’s my own lamp,” said Mrs. Sharpless. “Seventy years has at least taught me how to read.” “How, but not what,” answered the Health Master. “That’s a bad book you’re reading.” Grandma Sharpless achieved the proud athletic feat of bounding from her chair without the perceptible movement of a muscle. “Young man!” she exclaimed in a shaking voice, “do you know what book that is?” “I don’t care what book—” “It is the Bible.” “Is it? Well, Heaven inspired the writer, but not the printer. Text such as that ought to be prohibited by law. Isn’t there a passage in that Bible, ‘Having eyes, ye see not’?” “Yes, there is,” snapped Mrs. Sharpless. “And my eyes have been seeing and seeing straight for a good many more years than yours.” “The more credit to them and the less to you, if you’ve maltreated them with such sight-murdering print as that. Haven’t you another Bible?” Grandma Sharpless sat down again. “I have another,” she said, “with large print; but it’s so heavy.” “Prescription: one reading-stand. Now, Mrs. Clyde.” The mother of the family looked up from her magazine with a smile. “You can’t say that I haven’t large print or a good light,” she said. “The print is good, but the paper bad,” said the Health Master. “Bad, that is, as you are holding it under a full, unqualified electric light. In reading from glazed paper, which reflects like a mirror, you should use a very modified light. In fact, I blame myself from not
  • 33. having had all the electric globes frosted long since. Now, I’ve kept the worst offender for the last.” Charley detached his nose from his geography and looked up. “That’s me, I suppose,” he remarked pessimistically and ungrammatically. “I’m always coming in for something special. But I can’t make anything out of these old maps without digging my face down into ‘em.” “That’s a true bill against the book concern which turns out such a book, and the school board which permits its use. Charley, do you know why Manny isn’t playing football this year?” “Manny” was the oldest son of the family, then away at school. “Mother wanted him not to, I suppose,” said the boy. “No,” said Mrs. Clyde. “Dr. Strong persuaded me that the development he would get out of the game would be worth the risk.” “It was his eyes,” said the Health Master. “He is wearing glasses this year and will probably wear them next. After that I hope he can stop them. But his trouble is that he—or rather his teachers—abused his eyes with just such outrageous demands as that geography of yours. And while the eye responded then, it is demanding payment now.” “But a kid’s got to study, hasn’t he? Else he won’t keep up,” put in Bobs, much interested. “Not at the expense of the most important of his senses,” returned the Health Master. “And never at night, at Charley’s age, or even yours, Bobs.” “Then he gets dropped from his classes,” objected Bobs. “The more blame to his classes. Early learning is much too expensive at the cost of eye-strain and consequent nerve-strain. If we force a student in the early years to make too great demands on his eyes, the chances are that he will develop some eye or nervous trouble at sixteen or seventeen and lose far more time than he has gained before, not reckoning the disastrous physical effects.” “But if other children go ahead, ours must,” said Mrs. Clyde.
  • 34. “Perhaps the others who go ahead now won’t keep ahead later. There is a sentence in Wood and Woodruff’s textbook on the eye[1] which every public-school teacher and every parent should learn by heart. It runs like this: ‘That child will be happier and a better citizen as well as a more successful man of affairs, who develops into a fairly healthy, though imperfectly schooled animal at twenty, than if he becomes a learned, neurasthenic asthenope at the same age.’” [1] Commoner Diseases of the Eye, by Casey A. Wood and Thomas A. Woodruff, pp. 418, 419. “Antelope?” put in Bettina, who was getting weary of her exclusion from the topic. “I’ve got a picture of that. It’s a little deer.” “So are you, Toddles,” cried the doctor, seizing upon her with one hand and Susan Nipper with the other, and setting one on each shoulder, “and we’re going to keep those very bright twinklers of yours just as fit’as possible, both to see and be seen.” “But what of Charley and the twins?” asked Mr. Clyde. “Everything right, so far. They’re healthy young animals and can meet the ordinary demands of school life. But no more study at night, for some years, for Charley; and no more, ever, of fine-printed maps. Some day, Charley, you may go to the Orinoco. It’s a good deal more desirable that you should be able to see what there is to be seen there, then, than that you should learn, now, the name of every infinitesimally designated town on its banks.” “In my childhood,” observed Mrs. Sharpless, with the finality proper to that classic introductory phrase, “we thought more of our brains than our eyes.” “An inverted principle. The brain can think for itself. The eye can only complain, and not always very clearly in the case of a child. Moreover, Mrs. Sharpless, in your school-days the eye wasn’t under half the strain that it is in our modern, print-crowded world. The fact is, we’ve made a tremendous leap forward, and radically changed a habit and practice built up through hundreds and thousands of
  • 35. years, and Nature is struggling against great difficulties to catch up with us.” “I don’t understand what you are getting at,” said Mrs. Clyde, letting her magazine drop. “Have you tried walking on all fours lately?” inquired the physician. “Not for a number of years.” “Presumably you would find it awkward. Yet if, through some pressure of necessity, the human race should have to return to the quadrupedal method, the alteration in life would be less radical than we have imposed upon our vision in the last few generations.” “Sounds like flat nonsense to me,” said the downright Clyde. “We see just as all our ancestors saw.” “Think again. Our ancestors, back a very few generations, were an outdoor race living in a world of wide horizons. Their eyes could range over far distances, unchecked, instead of being hemmed in most of the time by four walls. They were farsighted. Indeed, their survival depended upon their being far-sighted; like the animals which they killed or which killed them, according as the human or the beast had the best eyes. Nowadays, in order to live we must read and write. That is, the primal demand upon the eye is that it shall see keenly near at hand instead of far off. The whole hereditary training of the organ has been inverted, as if a mountaineer should be set to diving for pearls; and the poor thing hasn’t had time to adjust itself yet. We employ our vision for close work ten times as much as we did a hundred years ago and ten thousand times as much as we did ten thousand years ago. But the influence of those ten thousand years is still strong upon us, and the human child is born with the eye of a savage or an animal.” “What kind of an animal’s eyes have I got?” demanded Bettina. “A antelope’s?” “Almost as far-sighted,” returned the Health Master, wriggling out from under her and catching her expertly as she fell. “And how do you think an antelope would be doing fine needlework in a kindergarten?”
  • 36. “But, Strong, few of us go blind,” said Mr. Clyde. “And of those who do, nearly half are needlessly so. That we aren’t all groping, sightless, about the earth is due to the marvelous adaptability of our eyes. And it is exactly upon that adaptability that we are so prone to impose; working a willing horse to death. In the young the muscles of accommodation, whereby the vision is focused, are almost incredibly powerful; far more so than in the adult. The Cherub, here, could force her vision to almost any kind of work and the eye would not complain much—at this time. But later on the effects would be manifest. Therefore we have to watch the eye very closely until it begins to grow old, which is at about twelve years or so. In the adult the eye very readily lets its owner know if anything is wrong. Only fools disregard that warning. But in the developing years we must see to it that those muscles, set to the task of overcoming generations of custom, do not overwork and upset the whole nervous organization. Sometimes glasses are necessary; usually, only care.” “In a few generations we’ll all have four eyes, won’t we?” asked Bobs, making a pair of mock spectacles with his circled fingers and thumbs. “Oh, let’s hope not. The cartoonists of prophecy always give the future man spectacles. But I believe that the tendency will be the other way, and that, by evolution to meet new conditions, the eye will fit itself for its work, unaided, in time. Meantime, we have to pay the penalty of the change. That’s a small price for living in this wonderful century.” “You say that half the blind are needlessly so,” said Mrs. Clyde. “Is that from preventable disease?” “About forty per cent, of the wholly blind. But the half-blind and the nervously wrecked victims of eye-strain owe their woes generally to sheer carelessness and neglect. By the way, eye-strain itself may cause very serious forms of disease, such as obstinate and dangerous forms of indigestion, insomnia, or even St. Vitus’s dance and epilepsy.”
  • 37. “But you’re not telling us anything about eye diseases, Dr. Strong,” said Julia. “There speaks our Committee on School Conditions, filled full of information,” said the Health Master with a smile. “Junkum has made an important discovery, and made it in time. She has found that two children recently transferred from Number 14 have red eyes.” “Maybe they’ve been crying,” suggested Bettykin. “They were when I saw them, acute Miss Twinkles, although they didn’t mean it at all. One was crying out of one eye, and one out of the other, which gave them a very curious, absurd, and interesting appearance. They had each a developing case of pink-eye.” “Horses have pink-eye, not people,” remarked Grandma Sharpless. “To be more accurate, then, conjunctivitis. People have that; a great many people, once it gets started. It looks very bad and dangerous; but it isn’t if properly cared for. Only, it’s quite contagious. Therefore the Committee on Schools, with myself as acting executive, accomplished the temporary removal of those children from school.” “And then,” the Committee joyously took up the tale, “we went out and trailed the pink-eye.” “We did. We trailed it to its lair in School Number 14, and there we found one of the most dangerous creatures which civilization still allows to exist.” “In the school?” said Bettykin. “Oo-oo! What was it?” “It was a Rollertowl,” replied the doctor impressively and in a sonorous voice. “I never heard of it,” said the Cherub, awestruck. “What is it like?” “He means a roller-towel, goosie,” explained Julia. “A towel on a roller, that everybody wipes their hands and faces on.” “Exactly. And because everybody uses it, any contagious disease that anybody has, everybody is liable to catch. I’d as soon put a rattlesnake in a school as a roller-towel. In this case, half the grade where it was had conjunctivitis. But that isn’t the worst. There was
  • 38. one case of trachoma in the grade; a poor little Italian whose parents ignorantly sent her to an optician instead of an oculist. The optician treated her for an ordinary inflammation, and now she will lose the sight of one eye. Meantime, if any of the others have been infected by her, through that roller-towel, there will be trouble, for trachoma is a serious disease.” “Did you throw out the roller-towel?” asked Charley with a hopeful eye to a fray. “No. We got thrown out ourselves, didn’t we, Junkum?” “Pretty near,” corroborated Julia. “The principal told Dr. Strong that he guessed he could run his school himself and he didn’t need any interference by—by—what did he call us, Dr. Strong?” “Interlopers. No, Cherub, an interloper is no relation to an antelope. It was four days ago that we left that principal and went out and whistled for the Fool-killer. Yesterday, the principal came down with a rose-pink eye of his own; the Health Officer met him and ordered him into quarantine, and the terrible and ferocious Rollertowl is now writhing in its death-agonies on the ash-heap.” “What about other diseases?” asked Mrs. Clyde after a pause. “Nothing from me. The eye will report them itself quick enough. And as soon as your eye tells you that anything is the matter with it, you tell the oculist, and you’ll probably get along all right, as far as diseases go. It is not diseases that I have to worry about, as your Chinese-plan physician, so much as it is to see that you give your vision a fair chance. Let’s see. Charley, you’re the Committee on Air, aren’t you? Could you take on a little more work?” “Try me,” said the boy promptly. “All right; we’ll make you the Committee on Air and Light, hereafter, with power of protest and report whenever you see your mother going out in a polka-dotted, cross-eyed veil, or your grandmother reading a Bible that needs burning worse than any heretic ever did, or any of the others working or playing without sufficient illumination. Here endeth this lecture, with a final word. This is it:—
  • 39. “The eye is the most nervous of all the body’s organs. Except in early childhood, when it has the recklessness and overconfidence of unbounded strength, it complains promptly and sharply of ill-usage. Now, there are a few hundred rules about when and how to use the eyes and when and how not to use them. I’m not going to burden you with those. All I’m going to advise you is that when your eyes burn, smart, itch, or feel strained, there’s some reason for it, and you should obey the warning and stop urging them to work against their protest. In fact, I might sum it all up in a motto which I think I’ll hang here in the library—a terse old English slang phrase.” “What is it?” asked Mr. Clyde. “‘Mind your eye,’” replied the Health Master.
  • 40. “O VI. THE RE-MADE LADY f all unfortunate times!” lamented Mrs. Clyde, her piquant face twisted to an expression of comic despair. “Why couldn’t he have given us a little more notice?” Impatiently she tossed aside the telegram which announced that her husband’s old friend, Oren Taylor, the artist, would arrive at seven o’clock that evening. “Don’t let it bother you, dear,” said Clyde. “I’ll take him to the club for dinner.” “You can’t. Have you forgotten that I’ve invited Louise Ennis for her quarterly—well—visitation?” Clyde whistled. “That’s rather a poser. What business have I got to have a cousin like Louise, anyway!” Upon this disloyal observation Dr. Strong walked into the library. He was a very different Dr. Strong from the nerve-shaken wanderer who had dropped from nowhere into the Clyde household a year previous as its physician on the Chinese plan of being employed to keep the family well. The painful lines of the face were smoothed out. There was a deep light of content, the content of the man who has found his place and filled it, in the level eyes; and about the grave and controlled set of the mouth a sort of sensitive buoyancy of expression. The flesh had hardened and the spirit softened in him. “Did you hear that, Strong?” inquired Mr. Clyde, turning to him. “I have trained ears,” answered Dr. Strong solemnly. “They’re absolutely impervious to any speech not intended for them.”
  • 41. “Open them to this: Louise Ennis is invited for dinner to-night. So is my old friend Oren Taylor, who wires to say that he’s passing through town.” “Is that Taylor, the artist of ‘The First Parting’? I shall enjoy meeting him.” “Well, you won’t enjoy meeting Cousin Louise,” declared Mr. Clyde. “We ask her about four times a year, out of family piety. You’ve been lucky to escape her thus far.” “Rather a painful old party, your cousin?” inquired the physician, smilingly, of Clyde. “Old? Twenty-two,” said Mrs. Clyde. “But she looks fifty and feels a hundred.” “Allowing for feminine exaggeration,” amended Clyde. “But what’s so wrong with her?” demanded the physician. “Nerves,” said Mrs. Clyde. “Stomach,” said Mr. Clyde. “Headaches,” said Mrs. Clyde. “Toe-aches,” said Mr. Clyde. “Too much money,” said Mrs. Clyde. “Too much ego,” said Mr. Clyde. “Dyspepsia.” “Hypochondria.” “Chronic inertia.” “Set it to music,” suggested Dr. Strong, “and sing it as a duet of disease, from ablepsy to zymosis, inclusively. I shall be immensely interested to observe this prodigy of ills.” “You’ll have plenty of opportunity,” said Mrs. Clyde rather maliciously. “You’re to sit next to her at dinner to-night.” “Then put Bettykin on the other side of me,” he returned. “With that combination of elf, tyrant, and angel close at hand, I can turn for relief from the grave to the cradle.”
  • 42. “Indeed you cannot. Louise can’t endure children. She says they get on her nerves. My children!” “Now you have put the finishing touch to your character sketch,” observed Dr. Strong. “A woman of child-bearing age who can’t endure children—well, she is pretty far awry.” “Yet I can remember Louise when she was a sweet, attractive young girl,” sighed Mrs. Clyde. “That was before her mother died, and left her to the care of a father too busy making money to do anything for his only child but spend it on her.” “You’re talking about Lou Ennis, I know,” said Grandma Sharpless, who had entered in time to hear the closing words. “Yes,” said. Dr. Strong. “What is our expert diagnostician’s opinion of the case? You know I always defer to you, ma’am, on any problem that’s under the surface of things.” “None of your soft sawder, young man!” said the old lady, her shrewd, gray eyes twinkling from her shrewd, pink face. “My opinion of Louise Ennis? I’ll give it to you in two words. Just spoiled.” “Taking my warning as I find it,” remarked the physician, rising, “I shall now retire to put on some chain armor under my evening coat, in case the Terrible Cousin attempts to stab me with an oyster-fork.” The dinner was not, as Mrs. Clyde was forced to admit afterward, by any means the dismal function which she had anticipated. Oren Taylor, an easy, discursive, humorous talker, set the pace and was ably seconded by Grandma Sharpless, whose knack of incisive and pointed comment served to spur him to his best. Dr. Strong, who said little, attempted to draw Miss Ennis into the current of talk, and was rewarded with an occasional flash of rather acid wit, which caused the artist to look across the table curiously at the girl. So far as he could do so without rudeness, the physician studied his neighbor. He saw a tall, amply-built girl, with a slackened frame whose muscles had forgotten how to play their part properly in holding the structure firm. Her face was flaccid. Under the large but dull eyes, there was a bloodless puffiness. Discontent sat enthroned at the
  • 43. corners of the sensitive mouth. A faint, reddish eruption disfigured her chin. Her two strong assets, beautifully even teeth and a wealth of soft, fine hair, failed wholly to save her from being a flatly repellent woman. Dr. Strong noted further that her hands were incessantly uneasy, and that she ate little and without interest. Also she seemed, in a sullen way, shy. Yet, despite all of these drawbacks, there was a pathetic suggestion of inherent fineness about her; of qualities become decadent through disuse; a charm that should have been, thwarted and perverted by a slovenly habit of life. Dr. Strong set her down as a woman at war with herself, and therefore with her world. After dinner Mr. and Mrs. Clyde slipped away to see the children. The artist followed Dr. Strong, to whom he had taken a liking, as most men did, into the small lounging-room, where he lighted a cigar. “Too bad about that Miss Ennis, isn’t it?” said Taylor abruptly. His companion looked at him interrogatively. “Such a mess,” he continued. “Such a ruin. Yet so much left that isn’t ruined. That face would be worth a lot to me for the ‘Poet’s Cycle of the Months’ that I’m painting now. What a November she’d make; ‘November, the withered mourner of glories dead and gone.’ Only I suppose she’d resent being asked to sit.” “Illusions are the last assets that a woman loses,” agreed Dr. Strong. “To think,” pursued the painter, “of what her Maker meant her to be, and of how she has belied it! She’s essentially and fundamentally a beautiful woman; that is why I want her for a model.” ‘“In the structure of her face, perhaps—” “Yes; and all through. Look at the set of her shoulders, and the lines of her when she walks. Nothing jerry-built about her! She’s got the contours of a goddess and the finish of a mud-pie. It’s maddening.” “More maddening from the physician’s point of view than from the artist’s. For the physician knows how needless it all is.”
  • 44. “Is she your patient?” “If she were I’d be ashamed to admit it. Give me military authority and a year’s time and if I couldn’t fix her so that she’d be proud to pose for your picture—Good Heavens!” From behind the drapery of the passageway appeared Louise Ennis. She took two steps toward the two men and threw out her hands in an appeal which was almost grotesque. “Is it true?” she cried, turning from one to the other. “Tell me, is it really true?” “My dear young lady,” groaned Taylor, “what can I say to palliate my unpard—” “Nevermind that! I don’t care. I don’t care anything about it. It’s my own fault. I stopped and listened. I couldn’t help it. It means so much to me. You can’t know. No man can understand. Is it true that I—that my face—” Oren Taylor was an artist in more than his art: he possessed the rare sense of the fit thing to do and say. “It is true,” he answered quietly, “that I have seen few faces more justly and beautifully modeled than yours.” “And you,” she said, whirling upon Dr. Strong. “Can you do what you said? Can you make me good-looking?” “Not I. But you yourself can.” “Oh, how? What must I do? D—d—don’t think me a fool!” She was half-sobbing now. “It may be silly to long so bitterly to be beautiful. But I’d give anything short of life for it.” “Not silly at all,” returned Dr. Strong emphatically. “On the contrary, that desire is rooted in the profoundest depths of sex.” “And is the best excuse for art as a profession,” said the painter, smiling. “Only tell me what to do,” she besought. “Gently,” said Dr. Strong. “It can’t be done in a day. And it will be a costly process.” “That doesn’t matter. If money is all—”
  • 45. “It isn’t all. It’s only a drop in the bucket. It will cost you dear in comfort, in indulgence, in ease, in enjoyment, in habit—” “I’ll obey like a child.” Again her hands went tremulously out to him; then she covered her face with them and burst into the tears of nervous exhaustion. “This is no place for me,” said the artist, and was about to escape by the door, when Mrs. Clyde blocked his departure. “Ah, you are in here,” she said gayly. “I’d been wondering—Why, what’s the matter? What is it?” “There has been an unfortunate blunder,” said Dr. Strong quickly. “I said some foolish things which Miss Ennis overheard—” “No,” interrupted the painter. “The fault was mine—” And in the same breath Louise Ennis cried:— “I didn’t overhear! I listened. I eavesdropped.” “Are you quite mad, all of you?” demanded the hostess. “Won’t somebody tell me what has happened?” “It’s true,” said the girl wildly; “every word they said. I am a mess.” Mrs. Clyde’s arms went around the girl. Sex-loyalty raised its war signal flaring in her cheeks. “Who said that?” she demanded, in a tone of which Dr. Strong observed afterward, “I never before heard a woman roar under her breath.” “Never mind who said it,” retorted the girl. “It’s true anyway. It wasn’t meant to hurt me. It didn’t hurt me. He is going to cure me; Dr. Strong is.” “Cure you, Louise? Of what?” “Of ugliness. Of hideousness. Of being a mess.” “But, my dear,” said the older woman softly, “you mustn’t take it to heart so, the idle word of some one who doesn’t know you at all.” “You can’t understand,” retorted the other passionately. “You’ve always been pretty!”
  • 46. “A compliment straight from the heart,” murmured the painter. The color came into Mrs. Clyde’s smooth cheek again. “What have you promised her, Dr. Strong?” she asked. “Nothing. I have simply followed Mr. Taylor’s lead. His is the artist eye that can see beauty beneath disguises. He has told Miss Ennis that she was meant to be a beautiful woman. I have told her that she can be what she was meant to be if she wills, and wills hard enough.” “And you will take charge of her case?” asked Mrs. Clyde. “That, of course, depends upon you and Mr. Clyde. If you will include Miss Ennis in the family, my responsibilities will automatically extend to her.” “Most certainly,” said Mrs. Clyde. “And now, Mr. Taylor,” she added, answering a look of appeal from that uncomfortable gentleman, “come and see the sketches. I really believe they are Whistler’s.” As they left, Dr. Strong looked down at Louise Ennis with a smile. “At present I prescribe a little cold water for those eyes,” said he. “And then some general conversation in the drawing-room. Come here tomorrow at four.” “No,” said she. “I want to begin at once.” “So as to profit by the impetus of the first enthusiasm? Very well. How did you come here this evening?” “In my limousine.” “Sell it.” “Sell my new car? At this time of year?” “Store it, then.” “And go about on street-cars, I suppose?” “Not at all. Walk.” “But when it rains?” “Run.” Eagerness died out of Louise Ennis’s face. “Oh, I know,” she said pettishly. “It’s that old, old exercise treatment. Well, I’ve tried that,
  • 47. and if you think—” She stopped in surprise, for Dr. Strong, walking over to the door, held the portière aside. “After you,” he said courteously. “Is that all the advice you have for me?” she persisted. “After you,” he repeated. “Well, I’m sorry,” she said sulkily. “What is it you want me—” “Pardon me,” he interrupted in uncompromising tones. “I am sure they are waiting for us in the other room.” “You are treating me like a spoiled child,” declared Miss Ennis, stamping a period to the charge with her high French heel. “Precisely.” She marched out of the room, and, with the physician, joined the rest of the company. For the remainder of the evening she spoke little to any one and not at all to Dr. Strong. But when she came to say good-night he was standing apart. He held out his hand, which she could not well avoid seeing. “When you get up to-morrow,” he said, “look in the mirror, [she winced] and say, ‘I can be beautiful if I want to hard enough.’ Good- bye.” Luncheon at the Clydes’ next day was given up to a family discussion of Miss Louise Ennis, precipitated by Mr. Clyde, who rallied Dr. Strong on his newest departure. “Turned beauty doctor, have you?” he taunted good-humoredly. “Trainer, rather,” answered Dr. Strong. “You might be in better business,” declared Mrs. Sharpless, with her customary frankness. “Beauty is only skin-deep.” “Grandma Sharpless’s quotations,” remarked Dr. Strong to the saltcellar, “are almost as sure to be wrong as her observations are to be right.” “It was a wiser man than you or I who spoke that truth about beauty.”
  • 48. “Nonsense! Beauty only skin-deep, indeed! It’s liver-deep anyway. Often it’s soul-deep. Do you think you’ve kept your good looks, Grandma Sharpless, just by washing your skin?” “Don’t you try to dodge the issue by flattery, young man,” said the old lady, the more brusquely in that she could see her son-in-law grinning boyishly at the mounting color in her face. “I’m as the Lord made me.” “And as you’ve kept yourself, by clean, sound living. Miss Ennis isn’t as the Lord made her or meant her. She’s a mere parody of it. Her basic trouble is an ailment much more prevalent among intelligent people than they are willing to admit. In the books it is listed under various kinds of hyphenated neurosis; but it’s real name is fool-in-the-head.” “Curable?” inquired Mr. Clyde solicitously. “There’s no known specific except removing the seat of the trouble with an axe,” announced Dr. Strong. “But cases sometimes respond to less heroic treatment.” “Not this case, I fear,” put in Mrs. Clyde. “Louise will coddle herself into the idea that you have grossly insulted her. She won’t come back.” “Won’t she!” exclaimed Mrs. Sharpless. “Insult or no insult, she would come to the bait that Dr. Strong has thrown her if she had to crawl on her knees.” Come she did, prompt to the hour. From out the blustery February day she lopped into the physician’s pleasant study, slumped into a chair, and held out to him a limp left hand, palm up and fingers curled. Ordinarily the most punctilious of men, Dr. Strong did not move from his stance before the fire. He looked at the hand. “What’s that for?” he inquired. “Aren’t you going to feel my pulse?” “No.” “Nor take my temperature?” “No.”
  • 49. “Nor look at my tongue?” “Certainly not. I have a quite sufficient idea of what it looks like.” The tone was almost brutal. Miss Ennis began to whimper. “I’m a m—m—mess, I know,” she blubbered. “But you needn’t keep telling me so.” “A mess can be cleared up,” said he more kindly, “under orders.” “I’ll do whatever you tell me, if only—” “Stop! There will be no ‘if’ about it. You will do as you are bid, or we will drop the case right here.” “No, no! Don’t drop me. I will. I promise. Only, please tell me what is the matter with me.” Dr. Strong, smiling inwardly, recalled the diagnosis he had announced to the Clydes, but did not repeat it. “Nothing,” he said. “But I know there must be. I have such strange symptoms. You can’t imagine.” Fumbling in her hand-bag she produced a very elegant little notebook with a gold pencil attached. Dr. Strong looked at it with fascinated but ominous eyes. “I’ve jotted down some of the symptoms here,” she continued, “just as they occurred. You see, here’s Thursday. That was a heart attack—” “Let me see that book.” She handed it to him. He carefully took the gold pencil from its socket and returned it to her. “Now, is there anything in this but symptoms? Any addresses that you want to keep?” “Only one: the address of a freckle and blemish remover.” “We’ll come to that later. Meantime—” He tossed the book into the heart of the coal fire where it promptly curled up and perished. “Why—why—why—” gasped the visitor,—“how dare you? What do you mean? That is an ivory-bound, gold-mounted book. It’s
  • 50. valuable.” “I told you, I believe, that the treatment would be expensive. This is only the beginning. Of all outrageous, unforgivable kinds of self- coddling, the hypochondria that keeps its own autobiography is the worst.” Regrettable though it is to chronicle, Miss Ennis hereupon emitted a semi-yelp of rage and beat the floor with her high French heels. Instantly the doctor’s gaze shifted to her feet. Just how it happened she could not remember, but her right foot, unprotected, presently hit the floor with a painful thump, while the physician contemplated the shoe which he had deftly removed therefrom. “Two inches and a half at least, that heel,” he observed. “Talk about the Chinese women torturing their feet!” He laid the offending article upon the hearth, set his own soundly shod foot upon it, and tweaked off two inches of heel with the fire-tongs. “Not so pretty,” he remarked, “but at least you can walk, and not tittup in that. Give me the other.” Shocked and astounded into helplessness, she mechanically obeyed. He performed his rough-and-ready repairs, and handed it back to her. “Speaking of walking,” he said calmly, “have you stored your automobile yet?” “No! I—I—I—” “After to-morrow I don’t want you to set foot in it. Now, then, we’re going to put you through a course of questioning. Ready?” Miss Ennis settled back in her chair, with the anticipatory expression of one to whom the recital of her own woe is a lingering pleasure. “Perhaps if I told you,” she began, “just how I feel—” “Never mind that. Do you drink?” “No!” The answer came back on the rebound. “Humph!” Dr. Strong leaned over her. She turned her head away. “You asked me as if you meant I was a drunkard,” she complained. “Once in a while, when I have some severe nervous
  • 51. strain to undergo, I need a stimulant.” “Oh. Cocktail?” “Yes. A mild one.” “A mild cocktail! That’s a paradox I’ve never encountered. How often do you take these mild cocktails?” “Oh, just occasionally.” “Well, a meal is an occasion. Before meals?” “Sometimes,” she admitted reluctantly. “You didn’t have one here last night.” “No.” “And you ate almost nothing.” “That is just it, you see. I need something: otherwise I have no appetite.” “In other words, you have formed a drink habit.” “Oh, Dr. Strong!” It was half reproach, half insulted innocence, that wail. “After a cocktail—or two—or three,” he looked at her closely, but she would not meet his eyes, “you eat pretty well?” “Yes, I suppose so.” “And then go to bed with a headache because you’ve stimulated your appetite to more food than your run-down mechanism can rightly handle.” “I do have a good many headaches.” “Do anything for them?” “Yes. I take some harmless powders, sometimes.” “Harmless, eh? A harmless headache powder is like a mild cocktail. It doesn’t exist. So you’re adding drug habit to drink habit. Fortunately, it isn’t hard to stop. It has begun to show on you already, in that puffy grayness under the eyes. All the coal-tar powders vitiate the blood as well as affect the heart. Sleep badly?” “Very often.”
  • 52. “Take anything for that?” “You mean opiates? I’m not a fool, Doctor.” “You mean you haven’t gone quite that far,” said the other grimly. “You’ve started in on two habits; but not the worst. Well, that’s all. Come back when you need to.” Miss Ennis’s big, dull eyes opened wide. “Aren’t you going to give me anything? Any medicine?” “You don’t need it.” “Or any advice?” Dr. Strong permitted himself a little smile at the success of his strategy. “Give it to yourself,” he suggested. “You showed, in flashes, during the dinner talk last night, that you have both wit and sense, when you choose to use them. Do it now.” The girl squirmed uncomfortably. “I suppose you want me to give up cocktails,” she murmured in a die-away voice. “Absolutely.” “And try to get along with no stimulants at all?” “By no means. Fresh air and exercise ad lib.” “And to stop the headache powders?” “Right; go on.” “And to stop thinking about my symptoms?” “Good! I didn’t reckon on your inherent sense in vain.” “And to walk where I have been riding?” “Rain or shine.” “What about diet?” “All the plain food you want, at any time you really want it, provided you eat slowly and chew thoroughly.” “A la Fletcher?” “Horace Fletcher is one of those fine fanatics whose extravagances correct the average man’s stolid stupidities. I’ve seen his fad made ridiculous, but never harmful. Try it out.”
  • 53. “And you won’t tell me when to come back?” “When you need to, I said. The moment the temptation to break over the rules becomes too strong, come. And—eh—by the way—eh —don’t worry about your mirror for a while.” Temporarily content with this, the new patient went away with new hope. Wiping his brow, the doctor strolled into the sitting-room where he found the family awaiting him with obvious but repressed curiosity. “It isn’t ethical, I suppose,” said Mr. Clyde, “to discuss a patient’s case with outsiders?” “You’re not outsiders. And she’s not my patient, in the ordinary sense, since I’m giving my services free. Moreover, I need all the help I can get.” “What can I do?” asked Mrs. Clyde promptly. “Drop in at her house from time to time, and cheer her up. I don’t want her to depend upon me exclusively. She has depended altogether too much on doctors in the past.” Mr. Clyde chuckled. “Did she tell you that the European medical faculty had chased her around to every spa on the Continent? Neurasthenic dyspepsia, they called it.” “Pretty name! Seventy per cent of all dyspeptics have the seat of the imagination in the stomach. The difficulty is to divert it.” “What’s your plan?” “Oh, I’ve several, when the time comes. For the present I’ve got to get her around into condition.” “Spoiled mind, spoiled body,” remarked Mrs. Sharpless. “Exactly. And I’m going to begin on the body, because that is the easiest to set right. Look out for an ill-tempered cousin during the next fortnight.” His prophecy was amply confirmed by Mrs. Clyde, who made it her business, amid multifarious activities, to drop in upon Miss Ennis with patient frequency. On the tenth day of the “cure,” Mrs. Clyde reported to the household physician:—
  • 54. “If I go there again I shall probably slap her. She’s become simply unbearable.” “Good!” said Dr. Strong. “Fine! She has had the nerve to stick to the rules. We needn’t overstrain her, though. I’ll have her come here tomorrow.” Accordingly, at six o’clock in the evening of the eleventh day, the patient stamped into the office, wet, bedraggled, and angry. “Now look!” she cried. “You made me store my motor-car. All the street-cars were crowded. My umbrella turned inside out. I’m a perfect drench. And I know I’ll catch my death of cold.” Whereupon she laid a pathetic hand on her chest and coughed hollowly. “Stick out your foot,” ordered Dr. Strong. And, as she obeyed: “That’s well. Good, sensible storm shoes. I’ll risk your taking cold. How do you feel? Better?” “No. Worse!” she snapped. “I suppose so,” he retorted with a chuckle. “What is more,” she declared savagely, “I look worse!” “So your mirror has been failing in its mission of flattery. Too bad. Now take off your coat, sit right there by the fire, and in an hour you’ll be dry as toast.” “An hour? I can’t stay an hour!” “Why not?” “It’s six o’clock. I must go home. Besides,” she added unguardedly, “I’m half starved.” “Indeed! Had a cocktail to-day?” “No. Certainly not.” “Yet you have an appetite. A bad sign. Oh, a very bad sign—for the cocktail market.” “I’m so tired all the time. And I wake up in the morning with hardly any strength to get out of bed—” “Or the inclination? Which?” broke in the doctor. “And my heart gives the queerest jumps and—”
  • 55. Welcome to our website – the ideal destination for book lovers and knowledge seekers. With a mission to inspire endlessly, we offer a vast collection of books, ranging from classic literary works to specialized publications, self-development books, and children's literature. Each book is a new journey of discovery, expanding knowledge and enriching the soul of the reade Our website is not just a platform for buying books, but a bridge connecting readers to the timeless values of culture and wisdom. With an elegant, user-friendly interface and an intelligent search system, we are committed to providing a quick and convenient shopping experience. Additionally, our special promotions and home delivery services ensure that you save time and fully enjoy the joy of reading. Let us accompany you on the journey of exploring knowledge and personal growth! ebookluna.com