An Introduction to Object Oriented Programming with Java 5th Edition by Thomas Wu ISBN 0073523305 9780073523309 pdf download
An Introduction to Object Oriented Programming with Java 5th Edition by Thomas Wu ISBN 0073523305 9780073523309 pdf download
https://ebookball.com/product/an-introduction-to-object-oriented-
programming-with-java-5th-edition-by-thomas-wu-
isbn-0073523305-9780073523309-16398/
https://ebookball.com/product/an-introduction-to-object-oriented-
programming-with-java-5th-edition-by-thomas-
wu-0073523305-9780073523309-15256/
https://ebookball.com/product/an-introduction-to-object-oriented-
programming-with-java-5th-edition-by-thomas-
wu-0073523305-9780073523309-15330/
https://ebookball.com/product/an-introduction-to-object-oriented-
programming-with-java-5th-edition-by-thomas-wu-
isbn-9780073523309-0073523305-15552/
https://ebookball.com/product/an-introduction-to-object-oriented-
programming-with-java-5th-edition-by-thomas-wu-
isbn-0073523305-9780073523309-16398/
Object Oriented Programming with Java 1st edition By Hanumanth Ladwa
ISBN 8450193403 9788450193403
https://ebookball.com/product/object-oriented-programming-with-
java-1st-edition-by-hanumanth-ladwa-
isbn-8450193403-9788450193403-25034/
https://ebookball.com/product/microsoft-visual-c-2017-an-
introduction-to-object-oriented-programming-7th-edition-by-joyce-
farrell-isbn-1337102100-9781337102100-25038/
https://ebookball.com/product/beginning-c-3-0-an-introduction-to-
object-oriented-programming-1st-edition-by-jack-
purdum-0470261293-978-0470261293-15238/
https://ebookball.com/product/object-oriented-programming-using-
c-an-introduction-1st-edition-by-pardoe-
king-0333692411-978-0333692417-15282/
https://ebookball.com/product/java-graphical-user-interfaces-an-
introduction-to-java-programming-1st-edition-by-david-etheridge-
isbn-11352/
www.allitebooks.com
An Introduction to Object-Oriented
TM
Programming with Java
Fifth Edition
C.Thomas Wu
Naval Postgraduate School
www.allitebooks.com
AN INTRODUCTION TO OBJECT-ORIENTED PROGRAMMING WITH JAVA™, FIFTH EDITION
Published by McGraw-Hill, a business unit of The McGraw-Hill Companies, Inc., 1221 Avenue of the
Americas, New York, NY 10020. Copyright © 2010 by The McGraw-Hill Companies, Inc. All rights reserved.
Previous editions © 2006, 2004, and 2001. No part of this publication may be reproduced or distributed in any
form or by any means, or stored in a database or retrieval system, without the prior written consent of The
McGraw-Hill Companies, Inc., including, but not limited to, in any network or other electronic storage or
transmission, or broadcast for distance learning.
Some ancillaries, including electronic and print components, may not be available to customers outside the
United States.
1 2 3 4 5 6 7 8 9 0 DOC/DOC 0 9
ISBN 978–0–07–352330–9
MHID 0–07–352330–5
All credits appearing on page or at the end of the book are considered to be an extension of the copyright page.
Wu, C. Thomas.
An introduction to object-oriented programming with Java / C. Thomas Wu (Otani).—5th ed.
p. cm.
Includes index.
ISBN 978–0–07–352330–9— ISBN 0–07–352330–5 (hard copy : alk. paper) 1. Object-oriented
programming (Computer science) 2. Java (Computer program language) I. Title.
QA76.64.W78 2010
005.1'17—dc22
2008053612
www.mhhe.com
www.allitebooks.com
To my family
www.allitebooks.com
www.allitebooks.com
Contents
Preface xi
www.allitebooks.com
vi Contents
3 Numerical Data 85
3.1 Variables 86
3.2 Arithmetic Expressions 94
3.3 Constants 99
3.4 Displaying Numerical Values 101
3.5 Getting Numerical Input 107
3.6 The Math Class 113
3.7 Random Number Generation 117
3.8 The GregorianCalendar Class 120
3.9 Sample Development 125
3.10 Numerical Representation (Optional) 136
www.allitebooks.com
Contents vii
www.allitebooks.com
viii Contents
www.allitebooks.com
Contents ix
www.allitebooks.com
x Contents
Index 963
Preface
xi
xii Preface
most difficult and require significant effort. For some of the three-star exer-
cises, students must find or study additional information beyond those pre-
sented in the book. Please keep in mind that the level of difficulties is only a
general guideline. One student may find some level-three exercises much eas-
ier than level-two exercises, for example.
Book Organization
There are 16 chapters in this book, numbered from 0 to 15. The first 11 chapters
cover the core topics that provide the fundamentals of programming. Chapters 11 to
15 cover intermediate-level topics such as sorting, searching, recursion, inheritance,
polymorphism, and file I/O. There are more than enough topics for one semester.
After the first 11 chapters (Ch 0 to Ch 10), instructors can mix and match materials
from Chapters 11 to 15 to suit their needs. We first show the dependency relation-
ships among the chapters and then provide a brief summary of each chapter.
Chapter Dependency
For the most part, chapters should be read in sequence, but some variations are
possible, especially with the optional chapters. Here’s a simplified dependency
graph:
0
1
4
5
6
7
8 9 10
*Note: Some examples use arrays,
11 12 13 14* 15 but the use of arrays is not an
integral part of the examples.
These examples can be modified
to those that do not use arrays.
Many topics from the early part
of the chapter can be introduced
as early as after Chapter 2.
Preface xiii
how the output can be aligned nicely. The optional last section of the chapter
introduces recursion as another technique for repetition. The recursive version
of a method that finds the greatest common divisor of two integers is given.
• Chapter 7 is the second part of creating programmer-defined classes. We
introduce new topics related to the creation of programmer-defined classes
and also repeat some of the topics covered in Chapter 4 in more depth. The
key topics covered in this chapter are method overloading, the reserved
word this, class methods and variables, returning an object from a method,
and pass-by-value parameter passing. As in Chapter 4, we provide many
lucid illustrations to make these topics accessible to beginners. We use the
Fraction class to illustrate many of these topics, such as the use of this and
class methods. The complete definition of the Fraction class is presented in
this chapter.
• Chapter 8 teaches exception handling and assertions. The focus of this chap-
ter is the construction of reliable programs. We provide a detailed coverage of
exception handling in this chapter. We introduce an assertion and show how it
can be used to improve the reliability of finished products by catching logical
errors early in the development.
• Chapter 9 covers nonnumerical data types: characters and strings. Both the
String and StringBuffer classes are explained in the chapter. Another string
class named StringBuilder is briefly explained in this chapter. An important ap-
plication of string processing is pattern matching. We describe pattern match-
ing and regular expression in this chapter. We introduce the Pattern and
Matcher classes and show how they are used in pattern matching. One section
is added to discuss the application of string processing in bioinformatics.
• Chapter 10 teaches arrays. We cover arrays of primitive data types and of ob-
jects. An array is a reference data type in Java, and we show how arrays are
passed to methods. We describe how to process two-dimensional arrays and
explain that a two-dimensional array is really an array of arrays in Java. Lists
and maps are introduced as a more general and flexible way to maintain a col-
lection of data. The use of ArrayList and HashMap classes from the java.util
package is shown in the sample programs. Also, we show how the WordList
helper class used in Chapter 9 sample development program is implemented
with another map class called TreeMap.
• Chapter 11 presents searching and sorting algorithms. Both N2 and Nlog2N
sorting algorithms are covered. The mathematical analysis of searching and
sorting algorithms can be omitted depending on the students’ background.
• Chapter 12 explains the file I/O. Standard classes such as File and JFile-
Chooser are explained. We cover all types of file I/O, from a low-level byte
I/O to a high-level object I/O. We show how the file I/O techniques are used
to implement the helper classes—Dorm and FileManager—in Chapter 8 and 9
sample development programs. The use of the Scanner class for inputting data
from a textfile is also illustrated in this chapter.
Preface xv
• Chapter 13 discusses inheritance and polymorphism and how to use them ef-
fectively in program design. The effect of inheritance for member accessibil-
ity and constructors is explained. We also explain the purpose of abstract
classes and abstract methods.
• Chapter 14 covers GUI and event-driven programming. Only the Swing-
based GUI components are covered in this chapter. We show how to use the
JOptionPane class for a very simple GUI-based input and output. GUI com-
ponents introduced in this chapter include JButton, JLabel, ImageIcon,
JTextField, JTextArea, and menu-related classes. We describe the effective use
of nested panels and layout managers. Handling of mouse events is described
and illustrated in the sample programs. Those who do not teach GUI can skip
this chapter altogether. Those who teach GUI can introduce the beginning part
of the chapter as early as after Chapter 2.
• Chapter 15 covers recursion. Because we want to show the examples where
the use of recursion really shines, we did not include any recursive algorithm
(other than those used for explanation purposes) that really should be written
nonrecursively.
xvi Preface
Problem Solving
Problem Statement
We start our development with a problem statement. The problem statement for our
sample programs will be short, ranging from a sentence to a paragraph, but the problem
statement for complex and advanced applications may contain many pages. Here’s the
problem statement for this sample development exercise:
Write an application that asks for the user’s first, middle, and last names and
replies with the user’s initials.
Overall Plan
Our first task is to map out the overall plan for development. We will identify classes nec-
essary for the program and the steps we will follow to implement the program. We begin
with the outline of program logic. For a simple program such as this one, it is kind of
obvious; but to practice the incremental development, let’s put down the outline of pro-
gram flow explicitly. We can express the program flow as having three tasks: Level-by-level Organization for
1. Get the user’s first, middle, and last names.
program
tasks
2. Extract the initials to formulate the monogram.
Programming Exercises
3. Output the monogram. Level 1 Programming Exercises ★
Having identified the three major tasks of the program, we will now identify the
classes we can use to implement the three tasks. First, we need an5.object In the RollDice program, we created three Die objects and rolled them once.
to handle
the input. At this point, we have learned about only the Scanner class, soRewrite it program so you will create only one Die object and roll it three
we will usethe
here. Second, we need an object to display the result. Again, we will use System.out,
times. as
it is the only one we know at this point for displaying a string value. For the string
6. Write a program that computes the total ticket sales of a concert. There are
three types of seatings: A, B, and C. The program accepts the number of
tickets sold and the price of a ticket for each of the three types of seats. The
total sales are computed as follows:
totalSales = numberOfA_Seats * pricePerA_Seat +
numberOfB_Seats * pricePerB_Seat +
numberOfC_Seats * pricePerC_Seat;
Write this program, using only one class, the main class of the program.
Development Exercises
7. Define a new class named Temperature. The class has two accessors—to-
For the following exercises, use the incremental development methodology to
Fahrenheit and toCelsius—that return the temperature in the specified unit
implement the program. For each exercise, identify the program tasks, create
a design document with class descriptions, and draw the program diagram. and two mutators—setFahrenheit and setCelsius—that assign the temperature
Map out the development steps at the start. Present any design alternatives and in the specified unit. Maintain the temperature internally in degrees Fahrenheit.
justify your selection. Be sure to perform adequate testing at the end of each Using this class, write a program that inputs temperature in degrees
development step. Fahrenheit and outputs the temperature in equivalent degrees Celsius.
11. In the sample development, we developed the user module of the keyless
entry system. For this exercise, implement the administrative module that
allows the system administrator to add and delete Resident objects and
modify information on existing Resident objects. The module will also allow
the user to open a list from a file and save the list to a file. Is it proper to
implement the administrative module by using one class? Wouldn’t it be
a better design if we used multiple classes with each class doing a single,
well-defined task?
12. Write an application that maintains the membership lists of five social clubs
in a dormitory. The five social clubs are the Computer Science Club, Biology
Club, Billiard Club, No Sleep Club, and Wine Tasting Club. Use the Dorm
Development Exercises
class to manage the membership lists. Members of the social clubs are give students an opportunity
Resident objects of the dorm. Use a separate file to store the membership
list for each club. Allow the user to add, delete, and modify members of to practice incremental
each club.
development.
Preface xvii
Object-Oriented Approach
We take the object-first approach to teaching object-oriented programming with emphasis
on proper object-oriented design. The concept of objects is clearly illustrated from the very
first sample program.
/*
Chapter 2 Sample Program: Displaying a Window
File: Ch2Sample1.java
*/
import javax.swing.*;
class Ch2Sample1 {
public static void main(String[] args) {
JFrame myWindow;
myWindow = new JFrame();
myWindow.setSize(300, 200);
myWindow.setTitle("My First Java Program");
myWindow.setVisible(true);
}
}
Good practices on
object-oriented design
are discussed
User module Dorm Resident
throughout the book
and illustrated through
numerous sample Door
programs.
Figure 8.8 Program diagrams for the user and administrative modules. Notice the same Dorm and
Resident classes are used in both programs. User and administrative modules will include one or more
classes (at least one is programmer-defined).
xviii Preface
Illustrative Diagrams
Illustrative diagrams are used to explain all key concepts of programming such as the
difference between object declaration and creation, the distinction between the primitive
data type and the reference data type, the call-by-value parameter passing, inheritance, and
many others.
number1 alan
number2 turing
number2 turing
:Professor
:Professor
temp
0 1 2 3 4 5
temp
Note: The old array will eventually
get returned to the system via
garbage collection.
0 1 2 3 4 5
Figure 10.16 How a new array that is 150 percent of the original array is created. The size of the
original array is 4.
Preface xix
Student Pedagogy
Design Guidelines
provide tips on good
Always define a constructor and initialize data members fully in the
constructor so an object will be created in a valid state. program design.
Things to Remember
boxes provide tips for
List the catch blocks in the order of specialized to more general exception classes.
students to remember key At most one catch block is executed, and all other catch blocks are ignored.
concepts.
We didn’t write
because it is not necessary. The simplify method returns a Fraction object, and in
the calling program, all we need is a name we can use to refer to this returned
Fraction object. Don’t forget that the object name (variable) and the actual object
instance are two separate things.
Quick Check
1. What will be displayed on the console window when the following code is exercises at the end of
executed and the user enters abc123 and 14? the sections allow
Scanner scanner = new Scanner(System.in);
students to test their
try { comprehension of
int num1 = scanner.nextInt(); topics.
System.out.println("Input 1 accepted");
int num2 = scanner.nextInt();
System.out.println("Input 2 accepted");
} catch (InputMismatchException e) {
System.out.println("Invalid Entry");
}
www.allitebooks.com
xx Preface
Acknowledgments
I would like to thank my good friends at McGraw-Hill’s editorial and production
departments. Needless to say, without their help, this book would not have seen the
light of the day. I thank especially Raghu Srinivasan and Lorraine Buczek for their
infinite patience.
External reviewers are indispensable in maintaining the accuracy and improv-
ing the quality of presentation. Numerous professors have participated as reviewers
over the course of five editions, and I thank them all again for their comments, sug-
gestions, and encouragement. I especially thank the reviewers of the Comprehen-
sive edition for their valuable input towards the revision of this fifth edition text.
Personal Story
In September, 2001, I changed my name for personal reasons. Prof. C. Thomas
Wu is now Prof. Thomas W. Otani. To maintain continuity and not to confuse
people, we continue to publish the book under my former name. For those who
care to find out a little about my personal history, they can do so by visiting
www.mhhe.com/wu
Introduction to
Computers and
Programming Languages
O b j e c t i v e s
1
2 Chapter 0 Introduction to Computers and Programming Languages
I n t r o d u c t i o n
One innovation of their machine was the use of binary numbers. (We discuss binary
numbers in Sec. 0.2.) At around the same time, Howard Aiken of Harvard University
was working on the Automatic Sequence-Controlled Calculator, known more com-
MARK I monly as MARK I, with support from IBM and the U.S. Navy. MARK I was very
similar to the Analytical Engine in design and was described as “Babbage’s dream
come true.”
MARK I was an electromechanical computer based on relays. Mechanical
relays were not fast enough, and MARK I was quickly replaced by machines based
ENIAC I on electronic vacuum tubes. The first completely electronic computer, ENIAC I
(Electronic Numerical Integrator And Calculator), was built at the University of
Pennsylvania under the supervision of John W. Mauchly and J. Presper Eckert.
Their work was influenced by the work of John Atanasoff.
ENIAC I was programmed laboriously by plugging wires into a control
panel that resembled an old telephone switchboard. Programming took an enor-
mous amount of the engineers’ time, and even making a simple change to a pro-
gram was a time-consuming effort. While programming activities were going on,
the expensive computer sat idle. To improve its productivity, John von Neumann
of Princeton University proposed storing programs in the computer’s memory.
stored program This stored program scheme not only improved computation speed but also al-
lowed far more flexible ways of writing programs. For example, because a pro-
gram is stored in the memory, the computer can change the program instructions
to alter the sequence of the execution, thereby making it possible to get different
results from a single program.
generations of We characterized these early computers with vacuum tubes as first-generation
computers computers. Second-generation computers, with transistors replacing the vacuum
tubes, started appearing in the late 1950s. Improvements in memory devices also
increased processing speed further. In the early 1960s, transistors were replaced by
integrated circuits, and third-generation computers emerged. A single integrated
circuit of this period incorporated hundreds of transistors and made the construction
of minicomputers possible. Minicomputers are small enough to be placed on desk-
tops in individual offices and labs. The early computers, on the other hand, were so
huge that they easily occupied the whole basement of a large building.
Advancement of integrated circuits was phenomenal. Large-scale integrated
circuits, commonly known as computer chips or silicon chips, packed the power
equivalent to thousands of transistors and made the notion of a “computer on a sin-
gle chip” a reality. With large-scale integrated circuits, microcomputers emerged in
the mid-1970s. The machines we call personal computers today are descendants of
the microcomputers of the 1970s. The computer chips used in today’s personal
computers pack the power equivalent to several millions of transistors. Personal
computers are fourth-generation computers.
Early microcomputers were isolated, stand-alone machines. The word per-
sonal describes a machine as a personal device intended to be used by an individual.
However, it did not take long to realize there was a need to share computer resources.
For example, early microcomputers required a dedicated printer. Wouldn’t it make
more sense to have many computers share a single printer? Wouldn’t it also make
sense to share data among computers, instead of duplicating the same data on
4 Chapter 0 Introduction to Computers and Programming Languages
If you want to learn more about the history of computing, there is a wealth of information
available on the Web.You can start your exploration from
www.yahoo.com/Computers_and_Internet/History
For more information on the pioneers of computers, visit
en.wikipedia.org/wiki/category:Computer_pioneers
Binary Numbers
To understand the binary number system, let’s first review the decimal number sys-
tem in which we use 10 digits: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9. To represent a number in
the decimal system, we use a sequence of one or more of these digits. The value that
each digit in the sequence represents depends on its position. For example, consider
the numbers 234 and 324. The digit 2 in the first number represents 200, whereas
the digit 2 in the second number represents 20. A position in a sequence has a
value that is an integral power of 10. The following diagram illustrates how the
0.2 Computer Architecture 5
Output
Devices
RAM
Communication
CPU
Devices
Storage
Devices
Input
Devices
Monitor
Printer (output device)
(output device)
Main Unit (housing
CPU, RAM, storage
devices, and
communication
devices)
Keyboard
(input device) Mouse
(input device)
••• • •••
104 103 102 101 100 10⫺1 10⫺2 10⫺3
Position Values
The value of a decimal number (represented as a sequence of digits) is the sum
of the digits, multiplied by their position values, as illustrated:
2 4 8 • 7
⫽ 2 ⫻ 100 ⫹ 4 ⫻ 10 ⫹ 8 ⫻ 1 ⫹ 7 ⫻ 1兾10
base-2
In the decimal number system, we have 10 symbols, and the position values
numbers are integral powers of 10. We say that 10 is the base or radix of the decimal number
system. The binary number system works the same as the decimal number system
binary number but uses 2 as its base. The binary number system has two digits (0 and 1) called bits,
and position values are integral powers of 2. The following diagram illustrates how
bits the values of positions are determined in the binary system:
Binary
Point
••• • •••
24 23 22 21 20 2⫺1 2⫺2 2⫺3
Position Values
1 0 1 • 1
22 21 20 2⫺1
binary-to-
decimal ⫽ 1 ⫻ 22 ⫹ 0 ⫻ 21 ⫹ 1 ⫻ 20 ⫹ 1 ⫻ 2⫺1
conversion
⫽ 1 ⫻ 4 ⫹ 0 ⫻ 2 ⫹ 1 ⫻ 1 ⫹ 1 ⫻ 1兾2
⫽4 ⫹0 ⫹1 ⫹ 1兾2 ⫽ 5.5
The binary system is more suitable for computers than the decimal system be-
cause it is far easier to design an electrical device that can distinguish two states
(bits 0 and 1) than 10 states (digits 0 through 9). For example, we can represent 1 by
turning the switch on and 0 by turning the switch off. In a real computer, 0 is repre-
sented by electrical voltage below a certain level and 1 by electrical voltage at or
above this level.
When you pay closer attention to the on/off switch on computers and other
electronic devices, you should notice an icon like this
RAM
RAM Random access memory or RAM is a repository for both program instructions and
data manipulated by the program during execution. RAM is divided into cells,
byte with each cell having a unique address. Typically, each cell consists of 4 bytes (B),
and a single byte (1 B) in turn consists of 8 bits. Each bit, which can be either on
or off, represents a single binary digit. RAM is measured by the number of bytes
it contains. For example, 128 kilobytes (KB) of RAM contains 128 ⫻ 1024 ⫽
131,072 B because 1 KB is equal to 210 ⫽ 1024 B. Notice that 1 K is not equal to
103, although 103 ⫽ 1000 is a close approximation to 210 ⫽ 1024. The first IBM
PC introduced in 1981 came with 16 KB of RAM, and the first Macintosh com-
puter introduced in 1984 came with 128 KB of RAM. In contrast, a typical PC
today has anywhere from 1GB (gigabytes) to 4GB of RAM. Given that 1GB is equal
to 1024 MB (megabytes) and 1 MB is equal to 1024 KB, we know that 2GB means
2 ⫻ 1024 MB ⫽ 2048 MB ⫽ 2048 ⫻ 1024 KB ⫽ 2,097,152 KB ⫽ 2,097,152 ⫻
1024 B ⫽ 2,147,483,648 B.
8 Chapter 0 Introduction to Computers and Programming Languages
CPU
CPU The central processing unit or CPU is the brain of a computer. The CPU is the com-
ponent that executes program instructions by fetching an instruction (stored in
RAM), executing it, fetching the next instruction, executing it, and so on until it en-
register counters an instruction to stop. The CPU contains a small number of registers, which
are high-speed devices for storing data or instructions temporarily. The CPU also
contains the arithmetic-logic unit (ALU), which performs arithmetic operations such
as addition and subtraction and logical operations such as comparing two numbers.
clock speed CPUs are characterized by their clock speeds. For example, in the Intel
Pentium 200, the CPU has a clock speed of 200 megahertz (MHz). The hertz is a
unit of frequency equal to 1 cycle per second. A cycle is a period of time between
two on states or off states. So 200 MHz equals 200,000,000 cycles per second. The
fastest CPU for commercially available personal computers was around 200 MHz
in 1997 when the first edition of this textbook was published. But by the beginning
of 1998, many vendors started selling 300-MHz machines. And in a mere 6 months,
by the middle of 1998, the top-of-the-line personal computers were 400-MHz ma-
chines. As of this writing in late 2008, we see computers with 2.93-GHz (2930-
MHz) CPU being advertized and sold. The increase of the CPU speed in the last two
decades is truly astonishing. The clock speed of the Intel 8080, the CPU introduced
in 1974 that started the PC revolution, was a mere 2 MHz. In contrast, the clock
speed of the Intel Pentium 4 introduced in 2001 was 2 GHz (2000 MHz). Table 0.1
lists some of the Intel processors.
I/O Devices
I/O devices Input/output or I/O devices allow communication between the user and the CPU.
Input devices such as keyboards and mice are used to enter data, programs, and
commands in the CPU. Output devices such as monitors and printers are used to
display or print information. Other I/O devices include scanners, bar code readers,
magnetic strip readers, digital video cameras, and musical instrument digital inter-
face (MIDI) devices.
Storage Devices
Storage devices such as disk and tape drives are used to store data and programs. Sec-
nonvolatile and
volatile
ondary storage devices are called nonvolatile memory, while RAM is called volatile
memory memory. Volatile means the data stored in a device will be lost when the power to the
device is turned off. Being nonvolatile and much cheaper than RAM, secondary stor-
age is an ideal medium for permanent storage of large volumes of data. A secondary
storage device cannot replace RAM, though, because secondary storage is far slower
in data access (getting data out and writing data in) compared to RAM.
The most common storage device today for personal computers is a disk
drive. There are two kinds of disks: hard and floppy (also known as diskettes). Hard
disks provide much faster performance and larger capacity, but are normally not re-
movable; that is, a single hard disk is permanently attached to a disk drive. Floppy
disks, on the other hand, are removable, but their performance is far slower and
their capacity far smaller than those of hard disks. As the standard floppy disks can
0.2 Computer Architecture 9
A table of Intel processors. For some CPUs, several types with different
Table 0.1 clock speeds are possible. In such case, only the fastest clock speed is
shown. For more information on Intel CPUs, visit http://www.intel.com.
Table CPU
Date
Introduced
Clock Speed
(MHz)
4004 11/15/71 0.108
8008 4/1/72 0.200
1970s 8080 4/1/74 2
8088 6/1/79 8
80286 2/1/82 12
1980s 80386SX 6/16/88 16
80486DX 4/10/89 25
Pentium 3/22/93 66
Pentium Pro 11/1/95 200
1990s Pentium II 5/7/97 300
Pentium II Xeon 6/29/98 400
Pentium III 10/25/99 733
store only up to approximately 1.44 MB, they are becoming less useful in today’s
world of multimegabyte image and sound files. They are fast becoming obsolete,
and hardly anybody uses them anymore. Removable storage media with much
higher capacity such as zip disks (capable of holding 100 to 250 MB of data) re-
placed floppy disks in late 1990s. Computer technology moves so quickly that zip
disks themselves are already becoming obsolete. The most common form of
portable storage medium today (2008) is a compact USB flash drive, also known as
a thumb drive, whose capacity ranges from 125 MB to 16 GB.
Hard disks can store a huge amount of data, typically ranging from 160 GB
(gigabyte; 1 GB ⫽ 1024 MB) to 500 GB for a standard desktop PC in 2008. Portable
and removable hard disk drives, with performance and capacity that rival those of
nonremovable hard disks, are also available, but their use is not widespread.
Compact disks (CDs) are commonly used for storing massive amounts of data,
approximately 700 MB. Many software packages we buy today—computer games,
www.allitebooks.com
10 Chapter 0 Introduction to Computers and Programming Languages
word processors, and others—come with a single CD. Before the CD became a popu-
lar storage device for computers, some software packages came with more than
20 floppy diskettes. Because of the massive storage capacity of the CD, most computer
vendors eliminated printed manuals altogether by putting the manuals on the CD.
Communication Devices
communication A communication device connects the personal computer to an internet. The tradi-
device tional communication device for computers at home and in small offices was the
modem. A modem, which stands for modulator-demodulator, is a device that con-
verts analog signals to digital and digital signals to analog. By using a modem, a
computer can send to and receive data from another computer over the phone line.
The most critical characteristic of a modem is its transmission speed, which is mea-
sured in bits per second (bps). A typical speed for a modem is 56,000 bps, commonly
called a 56K modem. Under an ideal condition (no line noise or congestion), a 56K
modem can transfer a 1 MB file in about 21⁄2 minutes. Frequently, though, the actual
transfer rate is much lower than the possible maximum. So-called DSL and cable
modems are not truly modems because they transfer data strictly in digital mode,
which allows for much faster connection speeds of 144K or above. High-speed satel-
lite connection to the Internet is also available today.
A communication device for connecting a computer to a LAN is a network
interface card (NIC). A NIC can transfer data at a much faster rate than the fastest
modem. For instance, a type of NIC called 10BaseT can transfer data at the rate of
10 Mbps over the network. Traditional networks are connected, or wired, by the cables.
Increasingly, networks are connected wirelessly, where data are carried over radio
waves. Wireless networking is called WiFi or 802.11 networking. Today you will find
wireless networking almost universally available at airports, hotels, and universities.
assembly One level above machine language is assembly language, which allows
language “higher-level” symbolic programming. Instead of writing programs as a sequence
of bits, assembly language allows programmers to write programs by using sym-
bolic operation codes. For example, instead of 10110011, we use MV to move the
contents of a memory cell into a register. We also can use symbolic, or mnemonic,
names for registers and memory cells. A program written in assembly language
might look like this:
MV 0, SUM
assembly code MV NUM, AC
ADD SUM, AC
STO SUM, TOT
Since programs written in assembly language are not recognized by the CPU,
assembler we use an assembler to translate programs written in assembly language into
machine-language equivalents. Compared to writing programs in machine lan-
guage, writing programs in assembly language is much faster, but not fast enough
for writing complex programs.
high-level High-level languages were developed to enable programmers to write pro-
languages grams faster than when using assembly languages. For example, FORTRAN
(FORmula TRANslator), a programming language intended for mathematical com-
putation, allows programmers to express numerical equations directly as
high-level code X = (Y + Z) / 2
0.4 Java
Java Java is a new object-oriented language that is receiving wide attention from both indus-
try and academia. Java was developed by James Gosling and his team at Sun Microsys-
tems in California. The language was based on C and C++ and was originally intended
for writing programs that control consumer appliances such as toasters, microwave
ovens, and others. The language was first called Oak, named after the oak tree outside
of Gosling’s office, but the name was already taken, so the team renamed it Java.
Java is often described as a Web programming language because of its use in
applet writing programs called applets that run within a Web browser. That is, you need a
Web browser to execute Java applets. Applets allow more dynamic and flexible dis-
semination of information on the Internet, and this feature alone makes Java an at-
tractive language to learn. However, we are not limited to writing applets in Java. We
application can write Java applications also. A Java application is a complete stand-alone
program that does not require a Web browser. A Java application is analogous to a
program we write in other programming languages. In this book, we describe Java
applications only because our objective is to teach the fundamentals of object-oriented
programming that are applicable to all object-oriented programming languages.
We chose Java for this textbook mainly for its clean design. The language de-
signers of Java took a minimalist approach; they included only features that are in-
dispensable and eliminated features that they considered excessive or redundant.
This minimalist approach makes Java a much easier language to learn than other
object-oriented programming languages. Java is an ideal vehicle for teaching the
fundamentals of object-oriented programming. All the sample programs in this
book are tested against the newest version, Java 6.0.
S u m m a r y
K e y C o n c e p t s
network binary numbers
LAN binary-to-decimal conversion
WAN machine language
internets and Internet assembly language
CPU assembler
RAM high-level language
I/O devices compiler
communication devices Java
C h a p t e r 0 E x e r c i s e s
Review Exercises
1. Visit your school’s computer lab or a computer store, and identify the
different components of the computers you see. Do you notice any unique
input or output devices?
2. Visit your school’s computer lab and find out the CPU speed, RAM size, and
hard disk capacity of its computers.
3. Convert these binary numbers to decimal numbers.
a. 1010
b. 110011
c. 110.01
d. 111111
14 Chapter 0 Introduction to Computers and Programming Languages
repeat 20 times [
let X = next input;
add X to sum;
]
printout sum;
T
HE July sun beat fiercely on the tin slate roofs of the houses
forming square of Stafford. It was noon, business was at a
standstill. The clerks and typewriters in Walton's bank yawning
and fanning themselves heat. The only occupied individual in the
building was the banker himself, who was crouched over his desk in
his little office making calculations on a pad of paper with a pencil.
Toby Lassiter was at the window of the receiving-teller when an old
man came in at the folding-screen door and asked if he might see
Mr. Walton personally. It was Stephen Whipple, and he carried a
travelling-bag in his hand; he was covered with dust, and marked in
the creases of his face by drifts of fine cinders.
“I'll see, sir, if you'll wait a minute,” Toby answered, with his best
window-manners; then he went to his employer, and returned to
pilot the caller back to the office.
“Stranded on a trip and wants a check cashed without
identification,” was Toby's mental comment as he led the way. “Well,
he's come to the wrong man, as he will mighty soon find out.”
Whipple gave a searching glance at the man who was rising from
the desk with impatiently lifted brows. He put his bag down at his
feet, but failed to extend his hand, as Walton evidently expected him
to do.
“Take a seat, sir, take a seat,” and the banker motioned to a chair
near the desk.
“Thanks.” The Westerner kicked his bag along toward the chair,
and sat down rather clumsily. He took out an enormous
handkerchief, also considerably begrimed, and mopped his perspiring
face.
“You've got a hot town, sir,” Whipple said, introductively.
“Some say so, and some say not,” Walton replied, succinctly.
“Well, sir,” he continued, “is there anything I can do for you? The
reason I make so bold as to ask is because my clerk said you wanted
to see me personally.”
“Yes, it is of a sort of personal nature; at least, I reckon, you
might call it that,” and the merchant reached down and caught the
handle of his bag for no obvious reason than that he wanted to
move it to a point equidistant between his two splaying feet. Then
he looked up, and there was a decided flush of embarrassment in his
face, which extended down to the soiled collar on his pudgy neck.
The banker, ever quick at the reading of countenances, came to the
conclusion that some sort of unbusiness-like request in regard to
needed funds was forthcoming, and he was already framing his
refusal.
“Well, sir—well, sir?” he said.
“The truth of the matter is that it is of such a personal nature that
it is purty hard to know how to get started at it,” Whipple finally got
out. “Of course, I am a stranger to you, and I've come, too, without
any letters of introduction or papers of identification, and—is there
any danger of anybody listening?”
“None whatever—none on earth!” Walton sniffed, impatiently. “You
can talk at the top of your voice if you want to; the walls are thick;
besides, I don't have secrets, and I don't know as I am in the
market for any.”
“No, of course not, Mr. Walton.” The flush in the visitor's face was
dying out and giving place to an expression of rather anxious rigidity.
“Well, I am glad we won't be overheard, at any rate, for I want to
talk to you in behalf of your son.”
“Oh, that's it, huh? I see! I see!” And Walton swept the form
before him with eyes in which the lights of anger were slowly but
positively kindling. “It is about him, is it? Well, wait till I send this
letter to the mail. I'll be back, sir. I'll be back.”
“All right, Mr. Walton. There's no hurry.”
With the letter in his hand the banker rose as if from the sheer
heat of the growing anger within him and went out. Standing in the
door of the main counting-room he caught Lassiter's eye and
signalled him to approach. Giving him the letter, Walton said: “Mail
that, and then come back and keep a peeled eye on that fat chap at
my desk. Do you remember what I said when that three thousand
dollars came from nowhere in particular by express awhile back,
along with the mealy-mouthed yarn from Fred about changing his
ways, and all that gush?”
“Yes, sir, I think so,” answered the startled Toby. “You said you
thought—”
“That it was a deep-laid plan amongst him and some other
sharpers to hoodwink me; and I told you, Toby, that I'd be willing to
bet money that it wouldn't be many days before somebody would
hike along this way to talk it over—some go-between, you
understand. Well, he's in there now, setting humped over his satchel
like a spider watching a fly. He thinks I'm the fly. I want to know
what he's got to say. I want to see his hand, you know, and I come
out here to take a whiff of air and steady myself so I wouldn't blurt
out what I thought too quick and drive him away. Keep your eye on
him after he leaves me, Toby, and see which way he goes. He looks
to me like some shyster lawyer who has taken up the matter and
thinks he is smart enough to fool me. Somebody has invested three
thousand in this scheme, and the deal is to be clinched this morning.
Huh! I'll sorter tote 'im along, Toby, and see if I can get onto his
game,” and, with a sly and yet nervous wink, Walton turned away.
“Yes, sir; all right now, sir,” he said, breezily, as he returned to his
desk and lowered himself into his chair. “We've got this room all to
ourselves, and are as snug as a bug in a rug, as the fellow said.
Now, fire ahead.”
“Of course, it must be a sort o' disagreeable subject for you to talk
about,” Whipple began, awkwardly, “and I'll admit to you, Mr.
Walton, that I thought over it a powerful long time before I finally
made up my mind to come.”
“Oh yes, of course,” Walton said, pulling his whiskers with his long
hand—“of course, you naturally would.”
“Especially as Fred had no idea of what I had in view,” the
Westerner said. “You see, I had to act wholly on my own
responsibility.”
“Yes, I see—I see, sir.” It was only by an effort that Walton kept a
sarcastic ring of irritation out of his voice, and he stroked into the
roots of his beard a smile of contempt at such puerile attempts to
deceive.
“And that's what makes the whole thing so hard on me,” the
merchant went on. “You see, I took it on myself to act for Fred in, I
might say, actual opposition to his wishes and judgment.”
Whipple then proceeded to give a full and accurate account of his
first introduction to Fred and all that had happened to him since,
withholding only his own name and the name of the town he was
from. And while he talked, pausing to wipe his wet brow at times, or
to clear his shaky voice, the banker watched him as a cat might a
mouse. He held a pencil in his long, steady fingers, and kept the
point of it on a pad of paper, raising his shrewd glance and lowering
it as suited his fancy. Had he been an artist, old Simon might have
sketched what to his understanding was the most subtly designing
face he had ever seen. Here was a man, he told himself, who
resorted even to the emotional methods of a ranting revivalist to
gain his nefarious aims. It was a wonderful conception, but it wofully
missed its mark, for it was being applied to a man who had no
emotions. It was being applied to a man, too, who was as eagerly
on the lookout for new tricks as a biologist for a new species of
insect. What a weakling the fellow was, for a man of that age, and
what fun it would be to suddenly undeceive him—let him know the
manner of man he was attempting, in such a shallow way, to bunco!
“Yes, I decided not to wait longer,” Whipple concluded, with a
sigh. “I didn't intend to act till the remaining three thousand was
paid; but, as I say, I—”
“It is only two, according to my calculations.” Walton thought he
had tripped him up, and smiled knowingly.
“Fred said he felt that another thousand, at least, was due as
interest at the rate you usually get.”
“Oh, I see; he's certainly liberal.” Walton smiled at his joke, and
bent his head over his pad to hide it.
“As I say,” the merchant resumed, “I intended to wait till the debt
was entirely paid, but things took a sudden turn that I didn't expect.
I offered to advance the money to Fred, but he wouldn't take it.”
“Oh, he wouldn't take it!” Walton said, with a hurried regret that
Toby was not present to enjoy the feast of stupidity being spread
before him. “I see; he didn't want it. That's a little bit like him.”
Simon's amusement showed itself now in his voice rather than in the
visage which he managed to keep unruffled. “But you say things had
sorter taken a twist around?”
“Yes; he was brave enough, and bearing up mighty well till me
and him took a trip, as much for pleasure as anything else, to New
York, and we passed through this very town, and—”
“So you passed through here?” Walton interrupted, and then to
himself he added: “I knew it. I knew Fred was hanging about Atlanta
and sending money to that woman. Huh, his fat agent is certainly
giving the snap away!”
“Yes, we passed through here one night, and, as our train was
delayed below town by a wreck ahead of us, Fred got out and
walked around. He was gone till after midnight, and when he came
back to the Pullman where I was I noticed that he was powerfully
upset, and begun to suspect that maybe this was his old home. He
started to tell me about it then, but I stopped him, and it was not till
we had been to New York and got back home that he finally told me
your name and where you lived. As I said, he has not been the same
since then, and, to be honest with you, Mr. Walton, I don't know of
anything in the world that will restore his peace of mind, except—”
“Except having me send for him,” Simon suddenly let himself go,
“and kill the fatted bull-yearling, and put a dinky-dinky cap on his
brow, and give him a key to the vault, and start in, hit or miss,
exactly where me and him left off!”
“You are hard on him, Mr. Walton,” Whipple gasped, fairly
staggered by the unexpected retort—“much harder, I must say, than
I had hoped to find you. He declared that you wasn't the sort that
would forgive easily, but, having been a father once myself, I didn't
believe you would, after hearing about your boy's life since he left
you, refuse to—”
“See here!” Walton interrupted, laying down his pencil and staring
at the visitor from eyes which fairly snapped with blended triumph
and rage, “you've held the floor long enough; now step aside and let
me take it. I don't know as I ever had the luck to run across just
such a specimen as you are. You've evidently had very little to do
with business men. You seem to have as little common sense as a
mountain school-teacher or a young preacher on his first circuit.
Here you come with a long, roundabout, hatched-up tale that is so
thin and full of holes that a body could throw a straw hat through it.
I'd have you understand that this here house is a bank. My own
granddaddy would have to be identified, if he was alive, before he
could cash a check at that front window, and yet here you come—
pitapat, pitapat, as unconcerned as a house-cat looking for a place
to lie down—back into my private quarters, and propose something
that may, or may not, involve every dollar I own on the top-side of
the earth. You do all that without even taking the trouble to hint at
who you are or where you hail from, and—”
“I'm not afraid to give you my name!” the merchant gasped, taken
wholly off his guard by the withering attack. “It is Stephen Whipple,
sir—W-h-i-double p-l-e, Whipple!” he spelled, and he leaned forward
and pointed a stiff finger at Walton's pad. “Write it down. It might
get away from you.”
“Are you plumb sure it ain't Jenkins?” the banker grinned,
significantly.
“No; nor Jones, nor Smith, nor Brown. It's Whipple—Stephen
Whipple. Put it down on your paper. Huh, I'm not ashamed of it!”
“All right, there you are, in big letters.” Walton laughed, still
victoriously, as he pencilled the name on the pad. “Now, one other
formality, please—your postoffice address?”
“My post-office—” Whipple hesitated. His astounded gaze went
down; he was all of a quiver, even to his bushy eyebrows.
“Why, it's this way—this way—” he stammered, and, raising his
helpless eyes to the banker's taunting ones, he came to a dead halt.
“I think it must be,” Walton chuckled. “In fact, it mighty nigh
always is that way when a feller gits in a corner. But surely, out of all
the places in the United States, you could think of some town,
railroad station, or cross-roads store. A word as uncommon as
Whipple would be hard for me to think of in a pinch. It seemed to
come handy to you. Maybe you've used it before, or had some dead
friend by that name.”
“You are not fair, sir!” The merchant was becoming exasperated by
the human riddle before him. “I told you I had come against your
son's knowledge or wish. He has kept his whereabouts from you up
to now, and I have no moral right to let it out. I reckon he is afraid
you will hound him down before he has a chance to pay back what
he owes you. The Lord knows, he has plenty of reason for being
cautious, for, if I am any judge, you are as hard and unforgiving as a
stone wall.”
“I haven't seen any reason to forgive him, or bother one way or
another about it,” old Simon hurled into the flushed face before him.
“I don't see any difference between the way me and him stand now
and six years ago. I reckon he thinks I'm on my last legs, and that
the three thousand he got by some hook or crook—or from some
crook—would be well invested as a gum-stickum plaster to put over
my eyes before I am put under ground. After he had staked that
much, he thought some oily-tongued friend of his might come and
reconnoitre and report favorable. Well, you've reconnoitred, Mr.—Mr.
Whipstock, and you can go back to Atlanta and tell him it is no go.
You may tell him I am much obliged to you all—whoever your gang
is—for the three thousand on account. I may be making a mistake
now by shooting off my mouth so quick, for if I had worked my
cards right I might have secured another payment by dropping a
tear or two; but it is worth something to say what I've said in the
way I've said it.”
“So you don't believe what I have told you?” Whipple gasped, in
astonishment.
“Not a blessed word—not a syllable,” Walton laughed, and he
threw himself back in his chair in sheer enjoyment of his visitor's
discomfiture.
“You don't believe he is in my employment—you don't believe he
earned the money by faithful work which he sent you—you don't
believe—” Whipple paused, at the end of his resources.
“No, I don't believe even that,” Walton jested. “But I'll tell you one
thing, and I mean it. I don't intend to have you coming around
bothering me with this matter any more at all. It is strictly my affair,
anyway. That boy was a bad egg when he was here, and from the
looks of you and your game I can't see that he has improved a dang
bit. I don't say I'd arrest him, neither; half the debt has been paid, if
it was paid for a sneaking reason, and he can rove where he will. He
is a good riddance. I used to bother about what might become of
him, but I don't now.”
“Say, look me in the eye!” Whipple suddenly demanded, and with
a fierceness that almost sent a shock of surprise through the banker.
“You've not believed what I have told you, it seems, because you
thought I was after your dirty money. Hard cash is the only thing
you can believe in, I see, and so I am going to use some of it to
convince you. You have no faith in your son—the only child God
gave you, and who is now honoring your gray hairs as they don't
deserve to be honored, but, thank Heaven! I believe in him from
head to foot. Before I left Atlanta, this morning, I prepared myself
for some sort of emergency like this.”
Whipple took out a long envelope and threw it on the desk under
the banker's eyes. “That contains three thousand dollars—six bills of
five hundred each. Take them! Your boy's debt is paid in full. I may
have spoiled his chances with you by coming here against his
knowledge, but he shall not lose by it. If I live to get back home I
shall provide for him in my will. I may look like a faker, but I flatter
myself—from all I have heard of you—that I am worth more to-day
in the financial world than you could be if you could live another
twenty-five years. Good-day, sir.”
CHAPTER XIV
T
AKING up his satchel, the merchant strode heavily from the
room. Doubting if he had heard aright, Walton tore open the
envelope and took out the bills. He spread them on the desk;
he fumbled them with quivering fingers; he took out a big
magnifying glass and essayed to examine them one by one, but his
excitement and perturbation rendered it impossible. Dropping his
hand on his call-bell, he gave a sharp ring, and Toby Lassiter came
in quickly. Brushing the money toward his clerk, Walton said:
“See if they are counterfeit. By gum!”
The clerk examined them with the glass while Walton watched him
with staring eyes.
“They seem to me to be all right, Mr. Walton,” Toby said,
wonderingly, as he laid the bills down.
“I reckon they are—my Lord, I reckon they are!” the banker said,
in his throat. “Credit it on my private account, Toby. Credit me with
three—my Lord, I didn't think—I had no idea that the dang fellow—
no, I'll attend to the money. Toby, you run out and see where he
goes. He may make for a hotel, or he may—but hurry!”
Twenty minutes later Toby came back and found Walton still at his
desk, the money before him; his face had taken on an ashen tinge,
the eye he raised had a lacklustre expression.
“Well?” he said, eagerly.
“I missed him for the first few minutes,” the clerk said. “He was on
the way to the train. I took the belt-line down. He was on the car
ahead. I was just in time to see him board the Atlanta special.”
“So he's gone?”
“Yes, he's gone, Mr. Walton.”
The old man stared helplessly for a minute into the puzzled face of
his clerk, and then he drew the pad to him on which he had written
the name of his caller.
“Me 'n' him had a tiff,” he said. “We had a sort o' tiff—I reckon you
might call it that—after he had told me a long cock-and-bull tale
about Fred reforming, and I laughed at him. I reckon I was rough.
Then he threw this money at me all in a chunk to settle off the boy's
account, and said it might talk plainer than he had. Toby, it don't
look exactly like a fake. Fakes ain't worked that way. You see, it was
all up between me and him, and there wasn't a thing he could gain
by it, and yet he yanked out this wad and threw it at me like so
much waste paper. He refused to say where he lives, but here's his
name. Fred wrote that the fellow he was with was a merchant, and a
big one at that. I wonder if there is any way of finding out just who
and what the dang fool is?”
“You say you didn't get his address?” Toby inquired, as he
helplessly stroked his colorless face and sparse mustache.
“No.” The banker uttered something like a moan of self-disgust.
“He intimated that he kept it back to keep me from running the boy
down. I reckon I made a big fool of myself in the presence of a man
that may have unlimited capital for all I know. That's where my
judgment slipped a cog for once, I reckon. I set in to believe he was
out after my money, and went a little mite over the limit. He didn't
look rich, covered with dust like he was, but he may be—he may be
all Fred has claimed. Can you think of any way, Toby, to get a report
on him?”
“I might take Bradstreet's by States,” the clerk suggested, “and
run through all the towns and cities far and near.”
“It would take a month to go through that big book,” Walton said,
dejectedly, “and I want to know to-day, right off. If—if I've made a
break as big as that, and—and gone and insulted a man who has
befriended my boy, and one who, in fact, says he intends to provide
for him liberally, why, it would be nothing but good business to make
what amend lies in my power. If the boy really has built himself up,
and made good connections, and the like, why, you see, Toby, I
ought not to be the first—the very first—to—to damage his interests.
What I said, in my rough way, you see, might have a tendency to
sort o' make this Whipple—if he is all right—think twice before
helping out the son of a man who rode as high a horse as I was
astride of just now. I must have a report on him, I tell you.”
“I'll go through the book, Mr. Walton,” the clerk said. “It wouldn't
take so awful long. I would only have to run through the W's, you
know, and needn't look in the little places. If he is in the wholesale
line, he must be in a town of over ten thousand.”
“That's a fact, that's a fact,” Walton agreed. “I reckon he didn't
think of that when he gave me his name, though I acknowledge I
kinder gouged it out of him when he was good and hot. Go bring the
book here and set at my desk. I'll not let the rest bother you. My
Lord! my Lord! What a mess!”
All that afternoon the clerk bent over the huge volume with its
closely printed columns on very thin paper. The closing hour came.
The typewriters and clerks went home and the front door was shut,
but still Toby read, patiently running the point of his pencil down
column after column. Night came on, and less than half of the book
still remained to be scanned.
“Go home to supper and come back,” Walton said, a strange light
burning in his shrewd eyes. “I'll meet you here. I want this thing
settled. I don't believe I could sleep with the doubt on my mind as
to whether that man was fooling me or not. It is a big thing—a
powerful big thing. If Fred has made himself of enough importance
to have a man like that come a long distance in his behalf, why, you
see, I ought to know about it, that's all—I ought to know about it.”
“Yes, you ought to know, Mr. Walton,” Lassiter said, as he laid a
blotter between the pages and reached for his hat. They went out
together and walked side by side to the corner, where the clerk had
to turn off.
“You sort o' believed in Fred all along, Toby,” the banker said,
tentatively—“that is, you used to talk him up to some extent.”
“I thought he was in earnest about what he wrote in that last
good-bye letter, Mr. Walton. It made a deep impression on me. It
sounded perfectly straight. And awhile back, when his other letter
came, bringing all that cash, I was more sure than ever. Even when
you said you believed it was a trick, somehow I couldn't exactly look
at it that way.”
“Well, see if you can locate this Whipple,” Walton said, and,
turning off, he trudged heavily homeward through the gathering
shadows.
He was on his way back to the bank about nine o'clock when he
saw Toby coming toward him. The clerk was walking rapidly,
swinging his long arms to and fro like pendulums.
“Well, well?” Walton exclaimed, as they met face to face on the
sidewalk in the flare of a gas-light.
“I have found him!” Toby chuckled. “There is no mistake. Stephen
Whipple is a whopping big wholesale grocer at Gate City, Oklahoma.
He's rated at over a million, with credit at the top notch.”
“You don't say!” A negro laborer with a bag of flour on his
shoulder was passing close by, and Walton laid his hand warmingly
on the arm of his clerk and drew him slowly along.
“You don't say!” he repeated, under his breath, as he clutched
Toby's thin arm, “and I talked to him like a dog—like a hound-dog. I
did that, when he could buy and sell me over and over. I sneered at
him, and just as good as called him a thief, when he was right then
befriending the son I'd cast off. Say, Toby, you've got a sight more
sense than I have; what do you think I ought to do about it?”
“I really don't know, Mr. Walton,” Toby replied, awkwardly. “Maybe
it would be a good idea for you to go out there. From the way Fred
wrote, it stands to reason he'd be glad to see you, anyway, and—”
“I couldn't do that, Toby,” Walton said, under his breath. “After the
stand I took and have held all these years, I couldn't go running
after him. I could do some things, but I couldn't do that. Besides,
you see, Whipple would know we'd looked up his standing, and think
I'd come because he was rich. But, say, I have an idea, Toby. Don't
you think you could get on the train and go out there and take a
look around?”
“Why, yes, if you advise it, Mr. Walton.”
“And you could go and hang about, in a quiet, know-nothing way,
without letting Fred see you, I reckon?”
“Easy enough, Mr. Walton, in a bustling place like that.”
“Well, then, I'll tell you what you do. Pack your grip to-night, and
take the eight-thirty train in the morning. Put up at some out-of-the-
way hotel, and lie low and pick up what information you can. Don't
go about Whipple's place of business; if Fred saw you, it would spoil
it all. I'll defray your expenses. You deserve a trip, anyway. Of
course, even if the boy has made such a good, comfortable nest for
himself out there, that woman business is still hanging over him, and
he wouldn't feel exactly like facing Stafford folks right now. But I
reckon he's been doing an honest man's part by her along with his
rise. He's been providing for her and the child pretty well, I'll be
bound. And in case he does come back, even on a visit, we'll help
him smooth over the matter as far as is in our power. He ain't the
first young chap that's let his blood get the upper hand. Some of the
great men of history have made like slips along at the start. Yes,
we'll try to manage that some way. We might even get her and her
mother to move off somewhere. I don't know—I only say it might be
done. Folks in a plight of that sort will do most anything when they
are paid, and it looks like Fred won't go a-begging. Now, good-bye,
Toby. You've got a job of detective work before you, but I believe
you'll be smart enough to put it through.”
“I'll do my best, Mr. Walton,” the clerk said. “Goodbye.”
CHAPTER XV
I
T was a delightfully cool and crisp morning for midsummer, and
Doctor Dearing was on the lawn between his house and Galt's,
when he noticed that the railroad president had come out into
his own grounds for a smoke. The two exchanged greetings through
cordial signals, and Galt crossed over and joined his friend.
“What news from New York?” he asked, as he flicked the ashes
from his cigar.
“They will be here to-morrow,” Dearing replied. “Madge has been
homesick for fully two weeks; but Uncle Tom made her stay longer,
hoping that she would become more interested in what was going
on. They have had all sorts of attentions paid them, but he writes
me that he has never been worried so much in his life over her. He
says she enjoyed the first two weeks thoroughly, but lately she has
been actually depressed. He tried everything imaginable, but home
was what she wanted and would have.”
“And so they are coming?” Galt said, reflectively.
“Yes, they are on the way now. After all, what better could one
ask for than a snug retreat like this in hot weather? Madge is fond of
home. She doesn't care for giddy social things among a lot of
money-spending Yankees, and I admire her taste.”
“Yes, so do I,” Galt answered, and he smoked steadily, his eyes
bent on the ground. .
“I have an unpleasant job on hand,” Dearing remarked. “I have
delayed it several times, but I have decided to do it to-day and have
it over with.”
“What is it?” Galt asked.
“It is a slight operation I have to perform on little Lionel.”
“Operation? Lionel?” Galt started, and then checked himself and
stared blankly. “I didn't know there was anything at all wrong with
him.”
“Oh, it is only a slight and common thing with children,” Dearing
explained. “Enlarged tonsils and adenoidal growth which must be
removed. Outwardly the little chap is as sound as a dollar, and, so
far, his wonderful strength has fought the thing off; but for a child so
nervous as he is, and high strung and imaginative, it might, later on
affect him seriously. Neglected cases have brought on permanent
deafness and lung trouble. It is inherited, as a rule; you, yourself,
had something of that sort, I think you told me.”
“Yes, yes,” Galt replied. Deep down within him something seemed
to clutch his vitals. In the ear of his naked soul an accusing voice
was sounding: “Inherited! Inherited!” The word rang out like a threat
from the Infinite—from the vast mystery of life which had of late
been so tenaciously closing around him. Even the pain Lionel was to
undergo was the outcome of another's sin.
“Oh, it is a very simple operation,” Dearing went on, “and in any
ordinary case I shouldn't give it a second thought; but, by George, I
have become attached to that little chap. He is the pluckiest little
man I ever knew. I had an exhibition of his grit one day that was
ahead of anything I ever saw in a child. He had fallen, and his upper
teeth had cut a deep gash in his tongue. They sent for me, and I
saw that I'd have to take a stitch in it to close the ugly gap. It was a
ticklish job, and I hardly saw how I could do it, for I didn't want to
use an anaesthetic. But I talked to him just as I would to a man, and
he promised me he wouldn't cry. He didn't. I give you my word, old
man, he didn't whimper as the needle went through, and even while
I was tying the thread; but I could see from his big, strained eyes
that it hurt him like rips. A child with grit like that, Kenneth, is bound
to make a stir in the world. I have noticed that you like him too, and
I am glad you do. The truth is, darn you, you are taking my place!
I'm jealous; he thinks you are a regular king. He is always talking
about you.”
“When do you think you will do the—the operation?” Galt faltered,
as he averted his shrinking glance from Dearing's face.
“Why, I want to do it right off. It is like this: his mother knows it
has to be done, and has agreed to leave it entirely to me; but she is
very nervous over it. She has a vein of morbid superstition running
through her. She fancies that some disaster is bound, sooner or later,
to happen to him—in fact, as she has often put it to me, she hardly
believes that a just God would allow such a sensitive and ambitious
child to grow up to a full comprehension of his humiliation.
“I see—I see what you mean,” Galt managed to say, and his soul
seemed to writhe anew as he stood trying to make his words sound
casual.
“So I thought,” the doctor went on, “that I'd like, if possible, to get
it over without her knowledge, or without her mother knowing of it.
Nervous people standing around, half frightened out of their wits, at
such a time, unsteady my hand and upset me generally. Now, as I
have everything in readiness up-stairs, I think, when Lionel comes
over this morning, as I've asked him to do, I'll talk him into it. Young
Doctor Beaman, my new assistant, is up-stairs sterilizing my
instruments, and he will give the chloroform. You see, it would be a
pleasant surprise and a relief to those doting women to suddenly
find out that the thing they have made such a fuss about is over and
no harm done.” Galt made no reply. He had seen a trim little figure
darting across the lower end of the lawn, and saw a flash of golden
tresses in the sunlight, and knew that Lionel was coming—and to
what? Galt suppressed an inward groan. The unsuspecting child was
bounding along, joyous and full of life, to the grim, inexplicable
snare which had been set for him. Young as he was, he was to be
asked to be firm and brave, that his little form might take on the
semblance of death and submit to the knife, a thing at the thought
of which even strong men had quailed. And what might, after all, be
the as yet unrevealed outcome? One case in every ten thousand, at
least, failed to survive the artificial sleep, owing to this or that
overlooked internal defect. Would this child of malignant misfortune
be that one?
Lionel drew near, sweeping the two men with merry eyes of
welcome. There was an instant's hesitation as to which to greet first,
and then instinct seemed to swerve him toward Galt, his hand
outstretched. With a queer throb of appreciation, the father took it
and felt it pulsate in his clasp.
“Come here, Lionel, my boy,” Dearing said, with affected lightness
of manner. “You remember what I said one day about those ugly
lumps down there in your little throat which are going to get bigger
and bigger, till after a while you can't eat any jam and cake? You
wouldn't like that, would you?”
“I remember.” Lionel passed his tapering hand over his white
throat. “I can feel them when I swallow.”
“And that is why you have those bad dreams, and jump in your
sleep, and think you are falling,” Dearing added, adroitly. “You know
you promised to let me get them out.”
“Oh, not to-day!” the boy protested, throwing a wistful glance up
at the unclouded sky. “I was going to build a really-really house out
of the bricks at the barn. I have a stove-pipe for a smoke-stack. I'll
show you both. Come with me! Oh, it's great!”
“Not to-day. Lionel, listen.” Dearing drew the boy close to him, and
tenderly stroked back his hair from his fine brow. “Mamma, you
know, is terribly nervous about it. Women are that way, aren't they?
Men and boys, like us, know better. She can hardly sleep at night for
thinking about it—even a little thing like that. We can do it now, and
I can run over and tell her you are sleeping like a kitten in my big
bed up-stairs, and she and Granny will be so glad. It won't hurt a
bit, you know, for the medicine will make you sleep through it all.” A
shadow of deep disappointment came into Lionel's expressive eyes.
The warm color of life in his face faded into tense gravity, and they
saw him clasp his little hands and wring them undecidedly.
“And you think to-day is the best time?” he faltered, on the edge
of refusal.
“The very best of all, Lionel,” Dearing said, gently. “You wouldn't
be afraid of me, would you?”
The child stared dumbly. To Galt's accusing sense the world had
never held a more desolate sentient being than this incipient
repetition of himself. The child had proved that he knew no physical
fear. To what, then, did he owe this evident clutch of horror? Could it
be due to some psychic warning of approaching danger, or was the
sensitive child telepathically governed by the morbid fears which, at
that moment, were raging in the heart of his father?
“Come, that's a good, nice boy!” Dearing urged. “I see you are
going to be a brave little man.”
“I'm not afraid it will hurt,” Lionel faltered, “but I don't like to be
put to—to sleep.”
“But it must be so, my boy,” the doctor said. “Come on. Mamma
will see us in a minute and smell a mouse.” For a moment yet the
child stood undecided, his gaze alternately on the two faces before
him. Suddenly, while they waited and his eyes were resting in
strange appeal on Galt, he asked:
“Will you come, too?”
A shock as if from some unknown force went through the man
addressed, but, seeing no alternative, he answered:
“If you wish it, yes, of course.”
“And you think I ought to—to do it?”
“Yes,” Galt nodded, his head rocking like that of an automaton.
“The doctor knows best.”
“Well, then, I'll go,” the boy sighed, with another wistful look over
the lawn. “I'll go.”
As they were entering the house, by some strange mandate of
fate or instinct the boy again took his father's hand, and Galt held it
as they began to ascend the broad, walnut stairs. Argue as he would
that the operation was only a most ordinary thing, to Galt's morbid
state of mind it assumed the shape of a tragedy staged and enacted
by the very imps of darkness.
On the way up the boy tripped on the stair-carpeting and slipped
and fell face downward. He was unhurt, but Galt raised him in his
arms and bore him up the remainder of the steps into a big, light
room off the corridor.
“Here we are, Doctor Beaman!” Dearing cheerily called out to a
slender, beardless young man, who, with a towel in hand, was
bending over some polished instruments on the bureau. “This is the
little chap who never cries when he is hurt. He is a regular soldier, I
tell you!”
“No, I'm not afraid,” the boy said, as he stood alone in the centre
of the room; but still, as his father noted, there was a certain
contradictory rigidity of his features which he had never remarked
before.
Galt told himself that the child's evident dread, vague as it was,
was also an inheritance; for he recalled how he himself had once
taken ether to have a slight operation performed. He had been a
man in years at the time, and yet the effect on his mind as to what
might be the outcome had been most depressing. That day, as he
was doing now, he had looked upon the drug-induced sleep as a
dangerous approach to death; and now, as then, he gravely feared
that the tiny thread of reduced vitality might be torn asunder. He
stood dumb with accusing horror as the two doctors hastily made
their grewsome arrangements, such as securing warm water, fresh
towels and sheets, which, in their very whiteness, suggested a
shroud.
The noise made as they drew a narrow table across the
resounding floor into the best light between the two windows jarred
harshly on his tense nerves. These things were grim enough, but the
wan isolation of the waiting child, as he stood with that war against
fear and shame of fear going on in his great, fathomless eyes, so
like those of his artist-mother—that appealing little figure, nameless,
disowned among men, was stamped on the retina of Galt's eye for
the remainder of his life.
“Now, take off your waist and collar and necktie,” Dearing said to
Lionel—“that will be enough. We'll have you all right in a jiffy. You
are not afraid now, are you?”
Galt's heart sank like a plummet, for the child's lips moved, but no
sound issued. The little fellow turned his face away as he began to
undress. He removed the flowing necktie, but his little fingers could
not unfasten the stiff linen collar.
“Help him, Kenneth,” Dearing said. “My hands are full.”
Galt obeyed, his fingers coming into contact with the cold chin of
the child and the soft flesh of his neck. He felt like snatching the boy
from the damnable spot, as a mother might her young from the
claws of a wild beast. Yet, outwardly calm, he drew the sleeves of
the child's blouse off and laid it on a chair.
“Now we are ready for you, young man,” Dearing said, lightly. “I
see you are not afraid I'll hurt you.”
“No, I know it won't hurt,” Lionel said, “but—”
“Don't you begin butting me,” Dearing laughed. “You are not a
goat like the one that butted Grover Weston heels over head the
other day.”
“If I shouldn't wake up—I mean if I really shouldn't, you know,”
Lionel finished, with a faint effort to smile at the doctor's jest, “won't
you please not tell my mother too quick? She gets frightened so
easily, and, you see, if I didn't wake up—if I never woke again—”
“Ah, come off!” Dearing laughed, as he turned to his assistant.
“Doctor, this kid hints that we don't know our business.”
“But if I didn't wake, if I didn't!” Lionel insisted, “you'd not scare
her, would you? And—and”—his lower lip quivered—“wouldn't you
tell her that I wasn't a bit afraid, and that I didn't cry, and—wait!
wait! Won't you tell her that it didn't hurt a single bit, not even a
little teensy bit?”
“Yes, yes,” Dearing said, and, considerably taken aback, he stared
at Galt rather than at the insistent speaker. “I'll tell her you are the
best boy in the world—the best, the bravest, and the sweetest. And
God knows I'll mean it,” he finished, in a lower tone to Galt. “I've
seen thousands of kids, Kenneth, but this one gets nearer me than
all the rest put together. I swear I am almost tempted to throw the
darn job up. But, you see, it has to be done. Doctor,” turning to his
assistant, “put him on the table, and I'll tickle his nose and make
him laugh. We'll make him have the funniest dreams he ever had.”
Doctor Beaman went to the boy and held out his arms, and Lionel
was lifted to the table and stretched out on the crisp sheet which
had been spread over it. Just then, happening to look round,
Dearing saw Galt's face, and hastily stepped to his side. “My Lord!”
he whispered, “I see this thing is going against you, old man. You
are nauseated; you look faint. Many men are that way—young
students sometimes have to give up surgery for that reason. It is
nothing to be ashamed of. You like the little chap, and your
sympathies are worked up, that's all. But, really, I don't think you
ought to stay. I become nervous if others are, and I must have a
free hand. Besides, if you were to keel over in a faint at an
important moment I couldn't look after you. You'd better run down-
stairs and take a whiff of air. I'll call you when it is over.”
“Is he going?—must he go?” Lionel asked, as he turned his head
and saw Galt moving to the door. “Yes,” Dearing said, “but only
down-stairs.”
“Oh,” the child exclaimed, regretfully, and averted his face, “I
thought he could stay!”
Down into the still silence of the great hall Galt went. There was
something heartlessly maddening in the calm, yellow sunlight on the
grass, which he could see through the doorway. The birds in the
trees, as they flitted about with twigs in their mouths and chirped in
glee, seemed mocking voices of despair from the deliberate tyranny
of the universe.
“God have mercy and spare him!” the man cried out from the
depths of his agony. “Spare him, O God, spare him!”
Unconscious of the incongruous prayer which had fallen from his
lips, he turned into the drawing-room, on the left of the hall, and
sank into an easy-chair, covering his face with his stiff hands.
Suddenly he heard a light step on the veranda, and, raising his eyes,
he saw Dora standing in the hall, glancing wildly and excitedly about
her. Possessed by the fear that she might call out, and thus make
her presence known at that most crucial moment, he rose and
hastened to her. She did not see him till he was close at her side,
and then she turned and their eyes met.
“Where is Lionel—where is my child?” she panted.
He stood staring at her, unable to formulate a reply, and, brushing
past him with an air of contempt, which he read all too clearly, she
turned to the stairs, and started to ascend.
“Oh, you mustn't—you really mustn't!” he called out in protest,
and he put a detaining hand on her arm.
Shrinking from his touch, she stared at him piteously.
“Then they really are doing it!” she cried. “They are up there
operating on my child! I knew it when Doctor Beaman drove up, and
Doctor Wynn came and asked Lionel to play over here.”
Galt made no denial. He stood beside her, swept out of himself by
the sheer power of her astounding beauty, as he now beheld it for
the first time since their parting. In his wildest stretch of fancy as to
what the years might have brought her, he had not dreamed that
she had become such a flower among women. There was a
seductive maturity of intellect in her faultless face. The strange,
appealing, and yet unreadable lights of genius were burning in her
Welcome to Our Bookstore - The Ultimate Destination for Book Lovers
Are you passionate about books and eager to explore new worlds of
knowledge? At our website, we offer a vast collection of books that
cater to every interest and age group. From classic literature to
specialized publications, self-help books, and children’s stories, we
have it all! Each book is a gateway to new adventures, helping you
expand your knowledge and nourish your soul
Experience Convenient and Enjoyable Book Shopping Our website is more
than just an online bookstore—it’s a bridge connecting readers to the
timeless values of culture and wisdom. With a sleek and user-friendly
interface and a smart search system, you can find your favorite books
quickly and easily. Enjoy special promotions, fast home delivery, and
a seamless shopping experience that saves you time and enhances your
love for reading.
Let us accompany you on the journey of exploring knowledge and
personal growth!
ebookball.com