100% found this document useful (4 votes)
5 views

An Introduction to Object Oriented Programming With Java 5th Edition by Thomas Wu 0073523305 9780073523309 download

The document is about 'An Introduction to Object Oriented Programming with Java, 5th Edition' by Thomas Wu, which covers the fundamentals of object-oriented programming using Java. It emphasizes an object-first approach, integrating Java 5.0 features and providing examples from natural sciences. The book includes a comprehensive structure with chapters on various programming concepts, exercises of varying difficulty, and additional resources for learning.

Uploaded by

erliskuest6m
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (4 votes)
5 views

An Introduction to Object Oriented Programming With Java 5th Edition by Thomas Wu 0073523305 9780073523309 download

The document is about 'An Introduction to Object Oriented Programming with Java, 5th Edition' by Thomas Wu, which covers the fundamentals of object-oriented programming using Java. It emphasizes an object-first approach, integrating Java 5.0 features and providing examples from natural sciences. The book includes a comprehensive structure with chapters on various programming concepts, exercises of varying difficulty, and additional resources for learning.

Uploaded by

erliskuest6m
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 69

An Introduction to Object Oriented Programming

With Java 5th Edition by Thomas Wu 0073523305


9780073523309 install download

https://ebookball.com/product/an-introduction-to-object-oriented-
programming-with-java-5th-edition-by-thomas-
wu-0073523305-9780073523309-17244/

Explore and download more ebooks or textbooks


at ebookball.com
Get Your Digital Files Instantly: PDF, ePub, MOBI and More
Quick Digital Downloads: PDF, ePub, MOBI and Other Formats

An Introduction to Object Oriented Programming With Java 5th Edition


by Thomas Wu 0073523305 9780073523309

https://ebookball.com/product/an-introduction-to-object-oriented-
programming-with-java-5th-edition-by-thomas-
wu-0073523305-9780073523309-15256/

An Introduction to Object Oriented Programming With Java 5th Edition


by Thomas Wu 0073523305 9780073523309

https://ebookball.com/product/an-introduction-to-object-oriented-
programming-with-java-5th-edition-by-thomas-
wu-0073523305-9780073523309-15330/

An Introduction to Object Oriented Programming with Java 5th Edition


by Thomas Wu ISBN 9780073523309 0073523305

https://ebookball.com/product/an-introduction-to-object-oriented-
programming-with-java-5th-edition-by-thomas-wu-
isbn-9780073523309-0073523305-15552/

An Introduction to Object Oriented Programming with Java 5th Edition


by Thomas Wu ISBN 0073523305 9780073523309

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/

Microsoft Visual C# 2017 An Introduction to Object Oriented


Programming 7th Edition by Joyce Farrell ISBN 1337102100 9781337102100

https://ebookball.com/product/microsoft-visual-c-2017-an-
introduction-to-object-oriented-programming-7th-edition-by-joyce-
farrell-isbn-1337102100-9781337102100-25038/

Beginning C 3 0 an introduction to object oriented programming 1st


edition by Jack Purdum 0470261293 978-0470261293

https://ebookball.com/product/beginning-c-3-0-an-introduction-to-
object-oriented-programming-1st-edition-by-jack-
purdum-0470261293-978-0470261293-15238/

Object Oriented Programming Using C An Introduction 1st Edition by


Pardoe, King 0333692411 978-0333692417

https://ebookball.com/product/object-oriented-programming-using-
c-an-introduction-1st-edition-by-pardoe-
king-0333692411-978-0333692417-15282/

Object Oriented Programming and Java 1st Edition by Danny Poo, Derek
Kiong 9813083964 9789813083967

https://ebookball.com/product/object-oriented-programming-and-
java-1st-edition-by-danny-poo-derek-
kiong-9813083964-9789813083967-15306/
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.

This book is printed on acid-free paper.

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

Global Publisher: Raghothaman Srinivasan


Director of Development: Kristine Tibbetts
Developmental Editor: Lorraine K. Buczek
Senior Marketing Manager: Curt Reynolds
Senior Project Manager: Jane Mohr
Lead Production Supervisor: Sandy Ludovissy
Lead Media Project Manager: Stacy A. Patch
Associate Design Coordinator: Brenda A. Rolwes
Cover Designer: Studio Montage, St. Louis, Missouri
(USE) Cover Image: © Getty Images
Compositor: Macmillan Publishing Solutions
Typeface: 10.5/12 Times Roman
Printer: R. R. Donnelley Crawfordsville, IN

All credits appearing on page or at the end of the book are considered to be an extension of the copyright page.

Library of Congress Cataloging-in-Publication Data

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

0 Introduction to Computers and


Programming Languages 1
0.1 A History of Computers 2
0.2 Computer Architecture 4
0.3 Programming Languages 11
0.4 Java 12

1 Introduction to Object-Oriented Programming and


Software Development 15
1.1 Classes and Objects 16
1.2 Messages and Methods 18
1.3 Class and Instance Data Values 20
1.4 Inheritance 23
1.5 Software Engineering and Software
Life Cycle 24

2 Getting Started with Java 29


2.1 The First Java Program 30
2.2 Program Components 39
2.3 Edit-Compile-Run Cycle 49
2.4 Sample Java Standard Classes 52
2.5 Sample Development 69
v

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

4 Defining Your Own Classes—Part 1 151


4.1 First Example: Defining and Using a Class 152
4.2 Second Example: Defining and Using Multiple Classes 162
4.3 Matching Arguments and Parameters 166
4.4 Passing Objects to a Method 168
4.5 Constructors 173
4.6 Information Hiding and Visibility Modifiers 180
4.7 Class Constants 183
4.8 Local Variables 191
4.9 Calling Methods of the Same Class 193
4.10 Changing Any Class to a Main Class 197
4.11 Sample Development 198

5 Selection Statements 221


5.1 The if Statement 222
5.2 Nested if Statements 233
5.3 Boolean Expressions and Variables 239
5.4 Comparing Objects 247
5.5 The switch Statement 252
5.6 Drawing Graphics 256
5.7 Enumerated Constants 266
5.8 Sample Development 272

www.allitebooks.com
Contents vii

6 Repetition Statements 303


6.1 The while Statement 304
6.2 Pitfalls in Writing Repetition Statements 313
6.3 The do–while Statement 319
6.4 Loop-and-a-Half Repetition Control 323
6.5 The for Statement 327
6.6 Nested for Statements 332
6.7 Formatting Output 334
6.8 Loan Tables 339
6.9 Estimating the Execution Time 342
6.10 Recursive Methods (Optional) 346
6.11 Sample Development 351

7 Defining Your Own Classes—Part 2 373


7.1 Returning an Object from a Method 374
7.2 The Reserved Word this 378
7.3 Overloaded Methods and Constructors 386
7.4 Class Variables and Methods 391
7.5 Call-by-Value Parameter Passing 395
7.6 Organizing Classes into a Package 402
7.7 Using Javadoc Comments for
Class Documentation 403
7.8 The Complete Fraction Class 408
7.9 Sample Development 418

8 Exceptions and Assertions 445


8.1 Catching Exceptions 446
8.2 Throwing Exceptions and Multiple catch Blocks 453
8.3 Propagating Exceptions 458
8.4 Types of Exceptions 466
8.5 Programmer-Defined Exceptions 469
8.6 Assertions 471
8.7 Sample Development 477

www.allitebooks.com
viii Contents

9 Characters and Strings 495


9.1 Characters 496
9.2 Strings 499
9.3 Pattern Matching and Regular Expression 510
9.4 The Pattern and Matcher Classes 517
9.5 Comparing Strings 521
9.6 StringBuffer and StringBuilder 523
9.7 String Processing and Bioinformatics 529
9.8 Sample Development 533

10 Arrays and Collections 555


10.1 Array Basics 556
10.2 Arrays of Objects 567
10.3 The For-Each Loop 577
10.4 Passing Arrays to Methods 582
10.5 Two-Dimensional Arrays 589
10.6 Lists and Maps 596
10.7 Sample Development 609

11 Sorting and Searching 633


11.1 Searching 634
11.2 Sorting 638
11.3 Heapsort 646
11.4 Sample Development 659

12 File Input and Output 685


12.1 File and JFileChooser Objects 686
12.2 Low-Level File I/O 695
12.3 High-Level File I/O 700

www.allitebooks.com
Contents ix

12.4 Object I/O 709


12.5 Sample Development 716

13 Inheritance and Polymorphism 733


13.1 A Simple Example 734
13.2 Defining Classes with Inheritance 737
13.3 Using Classes Effectively with Polymorphism 741
13.4 Inheritance and Member Accessibility 744
13.5 Inheritance and Constructors 749
13.6 Abstract Superclasses and Abstract Methods 753
13.7 Inheritance versus Interface 758
13.8 Sample Development 759

14 GUI and Event-Driven Programming 787


14.1 Simple GUI I/O with JOptionPane 790
14.2 Customizing Frame Windows 793
14.3 GUI Programming Basics 799
14.4 Text-Related GUI Components 808
14.5 Layout Managers 820
14.6 Effective Use of Nested Panels 830
14.7 Other GUI Components 839
14.8 Menus 857
14.9 Handling Mouse Events 861

15 Recursive Algorithms 881


15.1 Basic Elements of Recursion 882
15.2 Directory Listing 883
15.3 Anagram 885
15.4 Towers of Hanoi 888
15.5 Quicksort 890
15.6 When Not to Use Recursion 895

www.allitebooks.com
x Contents

Appendix A How to Run Java Programs 903

Appendix B Sample Programs 911

Appendix C Standard Classes and Interfaces 933

Appendix D UML Diagrams 955

Index 963
Preface

T his book is an introduction to object-oriented programming using the Java


programming language. We use the object-first approach where objects are used
from the first sample program. Object-oriented thinking is emphasized and pro-
moted from the beginning. Students learn how to use objects first and then learn
how to define their own objects.

Key Changes in the 5th Edition


The key differences between this edition and the fourth edition are as follows:
1. More Discussion on Java 5.0 Features and Java 6.0 Compatibility. Many
of the new Java 5.0 features are explained and used in the sample programs.
They include the enumerator type, the for-each loop construct, auto boxing
and unboxing, and the generics.
2. Exclusive Use of Console Input and Output. All the GUI related topics,
including the JOptionPane class, are moved to Chapter 14. Sample programs
before Chapter 14 use the standard console input (Scanner) and output
(System.out). Those who want to use JOptionPane for simple input and output
can do so easily by covering Section 14.1 before Chapter 3.
3. More Examples from Natural Sciences. In several key chapters, we illus-
trate concepts using examples from biology and chemistry. For example, in
Chapter 4, we use the elements in the periodic table to illustrate the concept of
programmer-defined classes. In Chapter 9, we demonstrate how the string
processing techniques are applied to implement DNA sequencing and other
common DNA operations.
4. Level-by-level Organization for Programming Exercises. Programming
exercises at the end of chapters are organized into three levels of difficulties.
The one-star level exercises require the basic understanding of the materials
covered in the chapter. The two-star level exercises require some additional
thinking beyond the basic understanding. The three-star level exercises are

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

Brief Chapter Summary


Here is a short description of each chapter:
• Chapter 0 is an optional chapter. We provide background information on
computers and programming languages. This chapter can be skipped or as-
signed as an outside reading if you wish to start with object-oriented pro-
gramming concepts.
• Chapter 1 provides a conceptual foundation of object-oriented programming.
We describe the key components of object-oriented programming and illus-
trate each concept with a diagrammatic notation using UML.
• Chapter 2 covers the basics of Java programming and the process of editing,
compiling, and running a program. From the first sample program presented in
this chapter, we emphasize object-orientation. We will introduce the standard
classes String, Date, and SimpleDateFormat so we can reinforce the notion of
object declaration, creation, and usage. Moreover, by using these standard
classes, students can immediately start writing practical programs. We describe
and illustrate console input with System.in and the Scanner class and output with
System.out.
• Chapter 3 introduces variables, constants, and expressions for manipulating
numerical data. We explain the standard Math class from java.lang and
introduce more standard classes (GregorianCalendar and DecimalFormat) to
continually reinforce the notion of object-orientation. We describe additional
methods of the Scanner class to input numerical values. Random number
generation is introduced in this chapter. The optional section explains how the
numerical values are represented in memory space.
• Chapter 4 teaches the basics of creating programmer-defined classes. We
keep the chapter accessible by introducting only the fundamentals with illus-
trative examples. The key topics covered in this chapter are constructors, vis-
ibility modifiers (public and private), local variables, and passing data to
methods. We provide easy-to-grasp illustrations that capture the essence of
the topics so the students will have a clear understanding of them.
• Chapter 5 explains the selection statements if and switch. We cover boolean
expressions and nested-if statements. We explain how objects are compared
by using equivalence (==) and equality (the equals and compareTo methods).
We use the String and the programmer-defined Fraction classes to make the
distinction between the equivalence and equality clear. Drawing 2-D graphics
is introduced, and a screensaver sample development program is developed.
We describe the Java 5.0 feature called enumerated type in this chapter.
• Chapter 6 explains the repetition statements while, do–while, and for. Pitfalls
in writing repetition statements are explained. One of the pitfalls to avoid is
the use of float or double for the data type of a counter variable. We illustrate
this pitfall by showing a code that will result in infinite loop. Finding the great-
est common divisor of two integers is used as an example of a nontrivial loop
statement. We show the difference between the straightforward (brute-force)
and the clever (Euclid’s) solutions. We introduce the Formatter class and show
xiv Preface

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

Hallmark Features of the Text

Problem Solving

Sample Development Programs


Sample Development
2.5 Sample Development
Most chapters include a sample development
Printing the Initials
Now that we have acquired a basic understanding of Java application programs, let’s
section that describes the process of
write a new application. We will go through the design, coding, and testing phases of the
software life cycle to illustrate the development process. Since the program we develop
incremental development.
here is very simple, we can write it without really going through the phases. However, it is
extremely important for you to get into a habit of developing a program by following the
software life cycle stages. Small programs can be developed in a haphazard manner, but
not large programs. We will teach you the development process with small programs first,
so you will be ready to use it to create large programs later.
We will develop this program by using an incremental development technique,
which will develop the program in small incremental steps. We start out with a bare-
bones program and gradually build up the program by adding more and more code to
it. At each incremental step, we design, code, and test the program before moving on
to the next step. This methodical development of a program allows us to focus our at-
tention on a single task at each step, and this reduces the chance of introducing errors
into the program.

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.

Administrative Dorm Resident


module

A helper class A class we One or more classes


provided to us implement we implement

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.

Numerical Data Object

int number1, number2; Professor alan, turing;


number1 = 237; alan = new Professor();
number2 = number1; turing = alan;

number1 alan

number2 turing

int number1, number2; Professor alan, turing;


number1 = 237; alan = new Professor();
number2 = number1; turing = alan;

number1 237 alan

number2 turing

:Professor

int number1, number2; Professor alan, turing;


number1 = 237; alan = new Professor();

number2 = number1; turing = alan;

number1 237 alan

number2 237 turing

:Professor

Figure 3.3 An effect of assigning the content of one variable to another.

Lucid diagrams are used effectively to explain Person[] temp;


entry
data structures and abstract data types. 0 1 2 3
int newLength = (int) (1.5 * entry.length);

temp = new Person[newLength];

:Person :Person :Person :Person


A B C D

temp

0 1 2 3 4 5

for (int i = 0; i < entry.length; i++) {


entry temp[i] = entry[i];
0 1 2 3 }
entry = temp;

:Person :Person :Person :Person


A B C D

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.

Tips, Hints, and Pitfalls


It is not necessary to create an object for every variable we use. Many novice pro-
grammers often make this mistake. For example, we write provide important points
for which to watch out.
Fraction f1, f2;
f1 = new Fraction(24, 36);
f2 = f1.simplify( );

We didn’t write

Fraction f1, f2;


f1 = new Fraction(24, 36);
f2 = new Fraction(1, 1); //not necessary
f2 = f1.simplify( );

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.

You Might Want to Know


We can turn our simulation program into a real one by replacing the Door class
boxes give students with a class that actually controls the door. Java provides a mechanism called Java
interesting bits of Native Interface (JNI) which can be used to embed a link to a low-level device dri-
information. ver code, so calling the open method actually unlocks the door.

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

Supplements for Instructors and Students


The book is supported by a rich array of supplements available through the text’s
website located at www.mhhe.com/wu
For Instructors, a complete set of PowerPoints, solutions to the chapter exercises,
and other resources are provided.
For Students, source code for all example programs, answers to Quick Check
exercises, and other resources are provided, as well as the optional galapagos pack-
age, which includes the Turtle class that is necessary in solving various chapter
exercises.

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

After you have read and studied this chapter, you


should be able to
0
• State briefly a history of computers.
• Name and describe five major components of
the computer.

• Convert binary numbers to decimal numbers


and vice versa.

• State the difference between the low-level and


high-level programming languages.

1
2 Chapter 0 Introduction to Computers and Programming Languages

I n t r o d u c t i o n

B efore we embark on our study of computer programming, we will present some


background information on computers and programming languages in this optional
chapter. We provide a brief history of computers from the early days to present and
describe the components found in today’s computers. We also present a brief history
of programming languages from low-level machine languages to today’s object-
oriented languages.

0.1 A History of Computers


Humans have evolved from a primitive to a highly advanced society by continually
inventing tools. Stone tools, gunpowder, wheels, and other inventions have changed
the lives of humans dramatically. In recent history, the computer is arguably the
most important invention. In today’s highly advanced society, computers affect our
lives 24 hours a day: Class schedules are formulated by computers, student records
are maintained by computers, exams are graded by computers, dorm security sys-
tems are monitored by computers, and numerous other functions that affect us are
controlled by computers.
Although the first true computer was invented in the 1940s, the concept of a
Charles computer is actually more than 160 years old. Charles Babbage is credited with
Babbage inventing a precursor to the modern computer. In 1823 he received a grant from
the British government to build a mechanical device he called the Difference
Difference Engine, intended for computing and printing mathematical tables. The device was
Engine based on rotating wheels and was operated by a single crank. Unfortunately, the
technology of the time was not advanced enough to build the device. He ran into
difficulties and eventually abandoned the project.
But an even more grandiose scheme was already with him. In fact, one of the
reasons he gave up on the Difference Engine may have been to work on his new con-
Analytical cept for a better machine. He called his new device the Analytical Engine. This
Engine device, too, was never built. His second device also was ahead of its time; the tech-
nology did not yet exist to make the device a reality. Although never built, the Ana-
lytical Engine was a remarkable achievement because its design was essentially
based on the same fundamental principles of the modern computer. One principle
that stands out was its programmability. With the Difference Engine, Babbage would
have been able to compute only mathematical tables, but with the Analytical Engine
he would have been able to compute any calculation by inputting instructions on
punch cards. The method of inputting programs to computers on punch cards was
actually adopted for real machines and was still in wide use as late as the 1970s.
The Analytical Engine was never built, but a demonstration program was
Ada Lovelace written by Ada Lovelace, a daughter of the poet Lord Byron. The programming lan-
guage Ada was named in honor of Lady Lovelace, the first computer programmer.
In the late 1930s John Atanasoff of Iowa State University, with his graduate
student Clifford Berry, built the prototype of the first automatic electronic calculator.
0.1 A History of Computers 3

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

individual machines? Wouldn’t it be nice to send electronic messages between the


computers? The notion of networked computers arose to meet these needs.
network Computers of all kinds are connected into a network. A network that connects
computers in a single building or in several nearby buildings is called a local-area
LAN network or LAN. A network that connects geographically dispersed computers is
called a wide-area network or WAN. These individual networks can be connected
WAN further to form interconnected networks called internets. The most famous internet
is simply called the Internet. The Internet makes the sharing of worldwide informa-
internet
tion possible and easy. The hottest tool for viewing information on the Internet is a
Web browser. A Web browser allows you to experience multimedia information
consisting of text, audio, video, and other types of information. We will describe
how Java is related to the Internet and Web browsers in Section 0.4.

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

1. Who was the first computer programmer?


2. Who designed the Difference Engine and Analytical Engine?
3. How many generations of computers are there?

0.2 Computer Architecture


A typical computer today has five basic components: RAM, CPU, storage devices,
I/O (input/output) devices, and communication devices. Figure 0.1 illustrates these
five components. Before we describe the components of a computer, we will ex-
plain the binary number system used in a computer.

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)

Figure 0.1 A simplified view of an architecture for a typical computer.

values of positions are determined:


Decimal
Point

••• • •••
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

102 101 100 10⫺1


⫽ 2 ⫻ 102 ⫹ 4 ⫻ 101 ⫹ 8 ⫻ 100 ⫹ 7 ⫻ 10⫺1

⫽ 2 ⫻ 100 ⫹ 4 ⫻ 10 ⫹ 8 ⫻ 1 ⫹ 7 ⫻ 1兾10

⫽ 200 ⫹ 40 ⫹8 ⫹ 7兾10 ⫽ 248.7


6 Chapter 0 Introduction to Computers and Programming Languages

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

The value of a binary number (represented as a sequence of bits) is the sum of


the bits, multiplied by their position values, as illustrated:

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

So the binary number 101.1 is numerically equivalent to the decimal num-


ber 5.5. This illustration shows how to convert a given binary number to the
decimal equivalent. How about converting a given decimal number to its binary
equivalent?
The following steps show how to convert a decimal number (only the whole
numbers) to the equivalent binary number. The basic idea goes something like
this:
1. Divide the number by 2.
decimal-to-
binary 2. The remainder is the bit value of the 20 position.
conversion 3. Divide the quotient by 2.
4. The remainder is the bit value of the 21 position.
5. Divide the quotient by 2.
6. The remainder is the bit value of the 22 position.
7. Repeat the procedure until you cannot divide any further, that is, until the
quotient becomes 0.
0.2 Computer Architecture 7

The following diagram illustrates the conversion of decimal number 25.

Division Division Division Division Division


#5 #4 #3 #2 #1
0 1 3 6 12
苶1苶1苶
2冄1 苶3苶1苶
2冄1 苶6苶1苶
2冄1 苶1苶2苶1苶
2冄1 2冄1苶2苶5苶1苶
0 2 6 12 24
1 1 0 0 1
24 23 22 21 20
16 ⫹ 8 ⫹ 0 ⫹ 0 ⫹ 1 ⫽ 25

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

This is a stylized representation of binary digits 0 and 1.

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

Xeon 9/25/01 2000


Pentium 4 4/27/01 2000
2000s Itanium 2 7/8/02 1000
Pentium 4 Extreme 2/2/04 3400
Edition
Core 2 Extreme 7/27/06 3200

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.

Many companies, in addition to CD or in lieu of, provide “boxless” online distribu-


tion of software. With this scheme, we buy and download the software directly to
our computers from the company websites. From some book publishers, especially
in the professional market, we can even buy an online version of their books. The
online version is most commonly downloaded as a single file stored in the Portable
Document Format (PDF) format.

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.

1. Name five major components of a computer.


2. What is the difference between volatile and nonvolatile memory?
3. What does the acronym CPU stand for?
4. How many bytes does the 64 KB RAM have?
5. Which device connects a computer to the Internet using a phone line?
0.3 Programming Languages 11

0.3 Programming Languages


Programming languages are broadly classified into three levels: machine languages,
machine assembly languages, and high-level languages. Machine language is the only pro-
language gramming language the CPU understands. Each type of CPU has its own machine
language. For example, the Intel Pentium and Motorola PowerPC understand differ-
ent machine languages. Machine-language instructions are binary-coded and very
low level—one machine instruction may transfer the contents of one memory loca-
tion into a CPU register or add numbers in two registers. Thus, we must provide many
machine-language instructions to accomplish a simple task such as finding the aver-
age of 20 numbers. A program written in machine language might look like this:
10110011 00011001
01111010 11010001 10010100
machine code 10011111 00011001
01011100 11010001 10010000
10111011 11010001 10010110

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

COBOL (COmmon Business-Oriented Language) is a programming language in-


tended for business data processing applications. FORTRAN and COBOL were de-
veloped in the late 1950s and early 1960s and are still in use. BASIC (Beginners
All-purpose Symbolic Instructional Code) was developed specifically as an easy
language for students to learn and use. BASIC was the first high-level language
12 Chapter 0 Introduction to Computers and Programming Languages

available for microcomputers. Another famous high-level language is Pascal, which


was designed as an academic language. Since programs written in a high-level lan-
compiler guage are not recognized by the CPU, we must use a compiler to translate them to
assembly language equivalents.
The programming language C was developed in the early 1970s at AT&T Bell
Labs. The C++ programming language was developed as a successor of C in the
early 1980s to add support for object-oriented programming. Object-oriented pro-
gramming is a style of programming gaining wider acceptance today. Although the
concept of object-oriented programming is old (the first object-oriented program-
ming language, Simula, was developed in the late 1960s), its significance wasn’t
realized until the early 1980s. Smalltalk, developed at Xerox PARC, is another
well-known object-oriented programming language. The programming language
we use in this book is Java, the newest object-oriented programming language,
developed at Sun Microsystems.

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

• Charles Babbage invented the Difference Engine and Analytical Engine,


precursors to the modern computer.
• Ada Lovelace is considered the first computer programmer.
Exercises 13

• The first two modern computers were MARK I and ENIAC I.


• John von Neumann invented the stored-program approach of executing
programs.
• Computers are connected into a network. Interconnected networks are
called internets.
• Binary numbers are used in computers.
• A typical computer consists of five components: RAM, CPU, storage
devices, I/O devices, and communication devices.
• There are three levels of programming languages: machine, assembly, and
high-level.
• Java is one of the newest high-level programming languages in use today.
This textbook teaches how to program using Java.

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

4. Convert these decimal numbers to binary numbers.


a. 35
b. 125
c. 567
d. 98
5. What is the maximum decimal number you can represent in 4 bits? 16 bits?
N bits?
6. If a computer has 128 MB of RAM, how many bytes are there?
7. How do high-level programming languages differ from low-level
programming languages?
8. Consider a hypothetical programming language called Kona. Using Kona,
you can write a program to compute and print out the sum of 20 integers
entered by the user:
let sum = 0;

repeat 20 times [
let X = next input;
add X to sum;
]

printout sum;

Is Kona a high-level language? Why or why not?


Other documents randomly have
different content
and Aegina, and so forth—telling him such stories from Greek history
as I could remember, or partially invent. In the Acropolis itself,
wandering among the splendid and touching ruins, there wasn’t a
soul but a dirty man, with large patches on his knees, gathering
snails.
“He follows the footsteps of Pericles, of Alcibiades, and of Solon,”
I said, “and from their dim traces he gathers snails for soup. Such,
my dear Teddy,” I added, tranquilly, “is all the history he knows. To
him the Acropolis is nothing but a hunting-ground for snails.”
“You’re talking exactly like Mr. Barlow!” replied Teddy, with a
dissatisfied snort.
In the afternoon we again set out for the Acropolis. At the
bottom of the sacred ascent a couple of carriages were waiting.
“It can scarcely be they,” I said. “They would come round and try
all the hotels first, surely.”
“Oh, a man like Brentin would do anything!” Teddy cried.
I looked into the first carriage, and soon recognized a little,
rather old, cloak Lucy used to wear, with a high Medici collar. She
never had much money for her clothes, poor child, and was apt to
be a little behind the fashions.
“It’s really they, Teddy,” I said. “Come along and we’ll give them
a fright. They deserve it.”
“They do, indeed!” shouted Teddy, scarlet with rage.
We peeped in cautiously at the entrance, and there they were.
We could see them all crossing from the Parthenon towards the
Erechtheum, headed by that toad Brentin. We let them get well
inside the walls of the beautiful little temple, and then we went
quickly across to the left towards them.
Just as we got up to the white marble walls, I pushed Teddy and
said, “Hide.” Then I went on in alone. Brentin was just saying, “This
is apparently the Erechtheum. There’s mighty little of it left; why
don’t they put it straight, anyway?”
You should just have seen their faces when they turned and saw
me. Lucy, who was looking very pale, ran tottering towards me with
a little cry, and nearly fainted in my arms. My sister followed, and
was soon on my other shoulder. Miss Rybot waved her parasol,
Forsyth and Hines cheered, and Arthur Masters gave a loud gone
away! All Brentin said was, with rather a forced smile, “Well, all
right, eh? Here you are. You got my telegram?”
We sat down on the fallen blocks of marble, and everybody
began talking at once. Where was Teddy, they asked, and why
wasn’t he with me? Had he really been caught, or had he, after all,
run straight away home in his fright?
As if trying to avoid a painful subject, “Why didn’t you come to
Venice, as we arranged?” I asked.
“We heard the French corvette was somewhere up in those
waters,” Brentin replied, “and thought it safer not. We should have
come to look for you here at once, only we calculated you couldn’t
possibly arrive till to-morrow. But what about Parsons? What’s the
matter with your telling us all about Parsons?”
“Poor Teddy!” I sighed, and everybody looked shocked. I had
scarcely made up my mind whether to say he was dead, or in prison
for life, when Teddy himself suddenly fell in among us on his hands
and knees. He looked so ghastly, with his white face and red cactus
scars—to say nothing of his extraordinary way of entering—that the
ladies began to scream, and Bob Hines fell over backward.
“Teddy!”
“Hush! Hush! Hush!” hissed Teddy. “Bailey Thompson!”
“Im-pawsible,” snarled Brentin. “He’s in Minorca.”
“I say it’s Bailey Thompson. I saw him from outside, just coming
in.”
“Alone?”
“Yes. Keep quiet!”
We all huddled close together and kept as still as death.
“I couldn’t be mistaken,” Teddy whispered. “He’s got on the same
clothes and carrying the shawl, and he was looking about him, just
as he used at Monte Carlo.”
“You don’t say!” said Brentin, looking scared. “What the plague is
he doing in Athens? We shall have all our trouble over again.” And
then, thinking he was not very polite, he added, “And how are you?
All right?”
“No thanks to you!” grunted Teddy, at which the unfeeling
Brentin began to chuckle.
“Somebody’s scratched your face well for you,” he laughed.
“Looks like marriage lines!”
We lay very still, hoping against hope Thompson wouldn’t think
the Erechtheum worth a visit; but the fact was he had looked in the
carriages outside and questioned the driver, and, from the cloaks
and what the man had said, made up his mind it was our party. So,
after peeping in at the Parthenon, he came straight across; we heard
his footsteps, the divisional tread, closer and closer. Then he
tumbled over a column, swore, and the next moment was inside
surveying us, huddled together like a covey of partridges, with an
expression I don’t find it at all easy to describe—it was such a
mixture of everything.
Poor creature, he had evidently suffered! His face was drawn, his
beard unshaved, and his forlorn eyes looked defiantly out from
under a heavily lined brow. His mouth was tight and grim, and yet
about the compressed lips there was an air of satisfaction, almost of
unholy mirth. When he saw us, ran his glance over us and noted we
were all there, netted for the fowler, flame leaped to his sombre
eyes. There was dead silence while he stepped majestically,
solemnly forward, threw his plaid shawl on a column, and
unbuttoned his dusty frock-coat.
“And how are you?” said Brentin, coolly. “Come to see over the
Acropolis?”
Thompson glared at him, and without replying sat down on his
shawl.
“How did you get here? Had a good voyage? Sakes alive, man,
what a hole in your boot!”
“Poor man!” whispered Lucy, “how fearfully tired and ill he looks.”
At so unexpected an expression of sympathy, the detective’s
expression suddenly changed. Poor wretch, he was worn out,
hungry, and depressed; humiliated and miserable, I suppose, at
being so egregiously outwitted; for his lip trembled, and, putting his
face in his dog-skin hands, he actually began to cry. I never felt so
ashamed of myself, so sorry for a man, in my life.
“Cry, baby, cry!” taunted Brentin. “Serve you thundering well
right—”
“Be quiet!” I sternly cried. Brentin scowled at me, while poor
Thompson began to search with blinking eyes for his handkerchief.
Then I went on, with real feeling in my voice:
“We are sorry, Mr. Thompson, for the way we have treated you,
but you must see there was no other course open to us. We were
entirely frank with you, but you were never frank with us. We
discovered your identity quite by accident, and took the advantage
we thought our due of the discovery.”
“Oh, all right, sir, thank you!”
“At any rate,” struck in the irrepressible Brentin, with a wink at
me, “you have the satisfaction of knowing you spoiled a fine piece of
work, which will now, I guess, be consummated by other more
imperfect hands than ours.”
“What!” said the detective, brightening. “You never even made
the attempt?”
“What do you take us for?” cried the ingenious and evasive
Brentin. “Make an attempt of that nature, with the sharpest
detective in old England on our heels? No, sir!”
Thompson looked pleased, and then, with sly malice, observed:
“But, after all, gentlemen, you might have done it with perfect
safety.”
“What!”
“With the most perfect safety, I assure you. I had not yet
communicated with the Monte Carlo police.”
“That so? But afterwards?”
“Oh, afterwards, I should have pinched you all, of course!”
“There you are!” cried Brentin; “we knew that, mighty well. No,
sir! There are no flies on us. You gave us a fright, Mr. Bailey
Thompson, and we, I guess, have given you one. But no real
damage has been done to either party. Let us cry quits. Your hand,
sir!”
The simple fellow shook his hand obediently, and, polite as ever,
bowed to the ladies. My sister he already knew. She smiled at him
and said:
“But how on earth have you got here, Mr. Bailey Thompson? We
all understood you were going to the Balearic Isles.”
“I know nothing of my original destination, madam,” the
detective replied. “I only know that after steaming for some few
hours in one direction, Mr. Van Ginkel suddenly bouted ship and
went full speed in the other.”
“But why, I wonder?”
“Some matter, I understood from the captain, connected with his
divorced wife.”
“The Princess Danleno,” said Brentin.
“Some such name. She had left Cannes and gone to San Remo,
and Mr. Van Ginkel was anxious to see her and effect a
reconciliation, so the captain told me. He is full of caprice, like all
invalids, and on the caprice seizing him he simply bouted ship
without a word. But first he had to get rid of me; so he carried me,
full speed ahead, to the southernmost point of Greece—somewhere
near Cape Colonna, I believe—and there he carted me ashore,
gentlemen, like a sack of coals.”
The poor man’s lip began to tremble again, and he looked round
our circle piteously for sympathy.
“Dear! dear!” murmured Brentin; “how like him! And never said a
word the whole time, I dare say?”
“Not one! That was early on Monday morning. Since then I have
been slowly making my way up the Morea with great difficulty and
discomfort, mainly on foot, and sometimes getting a lift in a country
wagon. At Nauplia I managed to secure a passage in a coasting
steamer, which, after a tempestuous voyage, has just landed me at
the Piræus. There I saw your yacht, gentlemen, and knew, of
course, you were in the neighborhood.”
“How did you manage about the language in the Peloponnese?”
asked Hines, curiously.
“Why, fortunately, I can draw a little,” replied the detective, who
was every moment recovering his spirits, “and anything I wanted I
drew. But, often as I drew a beefsteak or a chop, gentlemen,” he
said, plaintively, “I never got it. Nothing but eggs and a sort of
polenta, and once—only once—goat’s flesh, when I drew a
bedstead, in token that I wanted to sleep there. And the fleas,
gentlemen, the fleas!” he cried. “There is a large Greek flea—”
“Never mind that just now,” said Brentin, gravely. “There are
elegant and refined ladies present. The essential is you are safe, and
bear us all no malice. That is so, eh?”
“None in the world!” cried the good fellow. “But I shall be much
obliged if you will give me directions how to get home from the
Acropolis in Athens to Brixton. I have no money to speak of, and a
large hole in my right boot.”
“That will be all right, sir,” said Brentin, rising, with his grand air.
“Henceforth you are our guest. By-gones are by-gones, and we will
look after you till you are safely landed at Charing Cross.”
“Thence, by tram or ’bus, over Westminster Bridge,” murmured
Hines, as we all rose, shook ourselves, and prepared to descend.
“Well, all’s well that ends well,” cried Thompson. “But, all the
same, I rather regret, for all our sakes, the Monte Carlo business
was left untried.”
“Some other day, sir,” said Brentin; “some other day, when you
are enjoying your well-earned retirement, and an officer not quite so
plaguy sharp is in your place.”
The pleased detective walked jauntily on in front with the rest,
while Brentin, my sister, and I followed, Lucy clinging fondly to my
arm.
“But what are you going to do with him?” I whispered. “It is
ingenious to let him suppose the thing has not been done; but once
he gets on board the yacht he’s bound to discover all, and that he’s
been fooled again. Then it will be all up, indeed!”
“Some of you must take him home overland, on the pretence
there isn’t room for every one on the Amaranth.”
“But he must find it all out directly he gets to England, mustn’t
he?” said Lucy, softly.
“I hope to goodness he won’t come trooping over to Medworth
Square,” my sister observed. “I shall never hear the last of it from
Frank. And, after all, I’ve done nothing, have I?”
“True, O queen!” muttered Brentin, knitting his brows. “But by
the time he gets back the scent will be fairly cold. And the Casino
authorities are taking the sensible course of ignoring the whole
affair. That is so, isn’t it? No doubt, you’ve seen the papers.”
Yes, I said, I had, and that was their line.
“There you are, then! For the rest, we must simply trust our luck.
It has stood by us pretty well so far. Oh, and, by-the-way, what
about Mr. Parsons? How did you manage to get him out?”
I rapidly sketched my part in the affair, and made them all laugh
amazingly as I told them of my disguise and its accidental
resemblance to Lord B.
“Whether we are drunken men or fools,” laughed Brentin, “I
know not; but Providence has certainly looked after us so far in a
way that I may fairly call the most favored nation clause.”
“Quoti moris minus est, eo minus est periculi!” I quoted,
somehow happening to remember the sentence from my old Latin
grammar. “Which is the Latin, ladies, for ‘Where there is the less
fear, there is the less danger.’ ”
Lucy pressed my arm and smiled happily.
Just as we neared the carriages:
“By-the-way,” I asked, “what did it all tote up to?”
“The boodle?”
“Yes.”
“Just over one million four hundred and fifty thousand francs;
roughly speaking, fifty-eight thousand pounds of your money.”
“You’ll be back in Wharton Park, dearest,” I whispered, “before
the swallow dares!”
She pressed my arm again and smiled more happily than ever.
“The only thing that troubles me,” said my sister, “is how on
earth I am to establish an alibi to Frank’s satisfaction, in case there’s
a rumpus when we get back.”
“Alibis are old-fashioned nowadays,” I answered. “We shall have
to think of something else for you than an alibi.”
The unsuspicious Bailey Thompson was standing at one of the
carriage doors in a dandified attitude, making himself agreeable to
Miss Rybot.
As we drove away he again said—for after all he was human and
meant to be malicious—“But I do really wonder you didn’t do it,
gentlemen, after all!”
“Don’t torture us with remorse, Mr. Bailey Thompson, sir,” Brentin
cried; “the sense of neglected opportunity is hard to bear.”
“Well, all I can say is, I never saw an easier bit of work in my life,
and in my absence you were really perfectly safe. Those French
police are such utter fools, and as likely as not the Casino people
would have let you off. Come, now, confess! Don’t you regret it?”
“Sir,” said Brentin, loftily, “I regret nothing, and never did. All is
for the best in the best of all possible worlds.”
And the good detective couldn’t understand why, a few moments
later, Brentin was seized with a great roar of laughter. He explained
it was from seeing “Κοῦκ” in Greek letters over Cook’s offices; it
looked so droll! We all laughed heartily, too, and so drove up in
immense mirth and spirits to our hotel.
CHAPTER XXIII

WE ARRIVE SAFE IN LONDON AND GO TO MEDWORTH SQUARE—


BACK AT “THE FRENCH HORN”—NEWS AT LAST OF THE
AMARANTH—I INTERVIEW MR. CRAGE AND FIND HIM ILL

Very little remains to tell; but that little is of importance. Of our


journey home together (my sister, Lucy, Bailey Thompson, Parsons,
and I, the others sailing on board the yacht) I need say nothing, for
it was entirely pleasant and uneventful. Our luggage wasn’t even
robbed on the Italian lines; we felt the cold somewhat as we neared
home, and that was all.
At Charing Cross Thompson was evidently well-known to the
officials; he proclaimed us all his friends and above suspicion, so our
portmanteaus were barely looked at; everybody touched their hats
to him, and we felt quite royal in our immunities.
There we parted. Teddy jumped into a cab for Euston, to catch
the night express for his dear Southport; my sister, Lucy, and I went
off in a four-wheeler to Medworth Square; while the still
unsuspicious Thompson remained on the platform, bowing and
smiling. Once safely landed at Charing Cross, our duty to him was
plainly at an end. No doubt he would immediately go off to Brixton,
find his sister, Mrs. Wingham, and learn the truth; but what that
might mean to us I really neither knew nor cared. We had so far so
brilliantly succeeded that readers must not blame me if I continued
obstinately optimistic, and believed, whatever trouble might still be
in store for us, we should certainly somehow emerge from it
scathless and joyous.
“I hope,” my sister said, as we drove away, “he won’t think it
rude of me not asking him to come and call. After all, he’s not quite
of our world, and he would need such a deal of explaining, for Frank
always insists on knowing exactly who everybody is.”
“He won’t think of coming of his own accord, I suppose?”
whispered Lucy. “And, oh! I do so wish he wasn’t a friend of Mr.
Crage’s.”
“Lor’ bless you!” I philosophically remarked, “it’s even money we
none of us ever see or hear of him again.”
But we did, that day week exactly, when he turned up at “The
French Horn,” purple with ineffective rage, accompanied by his
dazed French confrère, Monsieur Cochefort.
In Medworth Square all was as usual. The Thursday evening
German band was playing the usual selection from that tiresome old
“Mikado,” and my sweet niece Mollie was soon tearing down the
stairs to welcome us.
“She watch for you every night, ma’am,” her Welsh nurse said;
“and last night she go down-stairs her best, and blow up Mr. Blyth
like anything for doing a door-bell ring exactly like yours, ma’am.”
My brother-in-law was very glad to get his wife back, and, having
been warned by letter, welcomed my dear Lucy with sufficient
warmth. How could he help it? Everywhere she went she won all
hearts. Brentin and Parsons both admired her desperately, and Bob
Hines, my sister told me, paid her more attention on the yacht
coming from Monte Carlo than he had ever been known to pay any
one before.
Even Forsyth, who is one of the most difficile men I know (unless
the young lady makes a dead set at him, when he thinks her lovely),
even he said to me, “That’s a real pretty girl, Vincent, and you’re a
very lucky man to get her;” while Miss Rybot once quite surprised
me by the warmth of her congratulation. “She’s so fresh and
unaffected, Mr. Blacker,” she said. “She’s like a breeze that meets
you at the end of a country lane when you come suddenly upon the
sea.” Which I thought both poetical and perfectly true—rather a rare
combination nowadays.
The next morning Lucy and I were off to Liverpool Street for
Nesshaven and “The French Horn.” As we drove up, and I saw the
familiar place once more, blinking in the soft February sunshine, just
as we had left it, I could scarcely believe all I had gone through in
the way of peril and adventure. Somehow, if one leaves a place for a
time, and has experiences of moment in the interval, one expects
those experiences to have had their effect elsewhere, too, even on
inanimate objects.
I felt older, wiser, more developed, more of a man, and I was
astonished to find the place quite unaltered and Mr. Thatcher looking
just the same as he came running out in his dirty old blazer. His
mother was at the window, gazing through the panes with the naïve
curiosity of a child at new arrivals. She kissed Lucy, and said to me:
“Well, here you are back safe, you bad young man. You’ve given us
a rare fright, I can tell you”—and that was all.
That same evening, when the ladies were safely abed, I had a
long talk with Mr. Thatcher in the bar parlor. After dear Lucy’s
escapade, we decided we might as well be married at once, without
waiting for Easter; and that, with the help of a license, the following
Thursday, February 6th, would be none too soon. For myself, apart
from other considerations, I thought it clearly wisest to get married
and clear out of the country, on a lengthy wedding-tour, as quick as
we could; so that, in case of search being made for me, as the head
and guiding spirit of the raid, I might, for some few months at any
rate, be non inventus.
Next, I delicately approached the subject of the repurchase of
Wharton Park. I told Mr. Thatcher we had been extraordinarily lucky
at Monte Carlo, and that, by a combination of rare circumstances, I
was the richer by £30,000 than when I started. He was shrewd
enough to listen in silence and ask no sort of question as to what
particular system I had pursued to enable me to return with so large
a sum. In fact, I scarcely gave him time to ask questions, I was so
rapid, hurrying forward only to the main point, whether Crage’s offer
were still open and we should still be able to get the old wretch out.
He told me that since Crage’s last visit and offer to marry Lucy he
had seen nothing of him, and, so far as he knew, the place was still
to be had. We could, if I liked, go up to the house in a day or two
and make inquiries cautiously, or write Crage a letter making him a
formal proposal.
To which I replied that, knowing something of human nature, I
judged it best, when we made our offer, to be prepared with the
actual sum in notes and gold to make it good; for, with a man like
Crage, combined of malice and craft, he would most likely try to
bluff and raise us unless he saw the very gold and notes before him,
beyond which, not having any more to offer, we were not prepared
to go.
“Very true,” said Thatcher. “There’s nothing like the ready to
tempt a man, as I know very well. Why, when I was in business—”
“Then all we can do,” I continued, cutting him short, “is to wait in
patience till the boodle—”
“The what?” said Thatcher, taking the pipe out of his mouth.
“It’s an American term—the money we have won, arrives. It’s
coming in the yacht, and should be here in a day or two now. Then
we’ll go up with it to the house, in a bag, and spread it out on the
table—”
“And I shall be back in Wharton Park again!” cried Thatcher.
“Gracious powers! Who would have thought it possible? And, of
course, it will be settled on Lucy. Me for life, and then Lucy. How
delighted my poor old mother will be!”
“Yes,” I said, “and that your name may be perpetuated, I will add
it to my own. Father-in-law, here’s health and prosperity to those
two fine old English families, the Thatcher-Blackers!”
So there was nothing we could do but wait in patience for the
arrival of the Amaranth. It was tedious, anxious work, for though I
never doubted all would be well, yet Bailey Thompson’s portentous
silence somewhat alarmed me; and as the days passed, and neither
he nor the yacht gave any sign of their existence, my nerves began
to get unstrung, and I grew worn and irritable.
Fortunately, as often happens in the early days of February, the
weather was beautifully fine; so fine that the more flatulent class of
newspapers were full of letters from country correspondents, who
were finding hedge-sparrows’ eggs and raspberries in their gardens,
and the usual Lincolnshire parson broke into jubilant twitterings over
his dish of green pease. Otherwise, I don’t think I really could have
borne it.
At last, late on the Tuesday evening, came a telegram from
Brentin at Southampton—“Safe, will arrive to-morrow”—and I began
to breathe a little easier. But not a word of any sort from Bailey
Thompson, neither a reproach nor a threat; till I felt like that
Damocles of Syracuse who, though seated on a throne, was yet
immediately under a faintly suspended sword. For here was I, on a
throne, indeed—the throne of dear Lucy’s pure and constant
affection—and yet!—at any moment!—
Dramatically enough, the sword fell on my very wedding morning
—on its flat side, happily—giving me a shock, but no cut of any sort,
as I am now briefly going to tell.
The next morning came another telegram from Brentin in
London, to say he would arrive at six and beg he might be met. All
was well, he wired, adding “Any news Thompson?”
I wired back to the “Victoria” there was none: “bring boodle with
you;” and then I went off and found Thatcher.
For always I had had the fancy to pay old Crage out of the place
and be married on the same day, and here was now my chance. We
were to be married in Nesshaven Church, in the grounds of Wharton
Park, at twelve; what was to prevent us, I said to Thatcher, from
walking on up to the house first with £30,000, completing the
purchase, and hasting to the wedding afterwards? Thence back to
“The French Horn” for a light lunch, afterwards catch the half-past-
two train for Liverpool Street, and so to Folkestone in the evening.
There was nothing to prevent it, said Thatcher, who for the last
two days had gone about in a triumphant, bulging white waistcoat;
only it would require rather delicate handling, all to be done
successfully. Crage should be prepared, for instance, he thought; for,
notwithstanding the sight of the money, the sight of dear Lucy in her
happy wedding radiance might turn him sour, and he might after all
refuse to complete. What was to prevent one of us, he said—
meaning, of course, me—going up to the house and sounding the
old man first? Then we should know exactly how we stood, and
what chance there was of our money being accepted.
Now, for the last week nothing had been seen of the old man,
and rumors had reached us, chiefly through the gardener, he was
very ill. He hadn’t been to church for more than a month, and at
church he had always been a very regular attendant; not so much
because he had any real religion in him as that he might aggravate
the parson by catching him up loudly in the responses, and barking
his way harshly through the hymns a good half-line behind the rest
of the congregation. Indeed, the chief attraction, I fear, at
Nesshaven Church was old Crage and his nauseous eccentricities,
and people who had heard how he had once lighted up his pipe
during the sermon and sat there sucking at it in the Wharton pew,
came from miles round in the hope he would enliven the discourse
by doing it again.
Nor had he been seen about the grounds, nor stumping down to
the inn, as he mostly did once a week to insult the inmates; in short,
the end that comes to us all—good, bad, and indifferent—was clearly
coming now to him, and if business were ever to be done, it must be
done speedily and at once.
So, before Brentin came, early on the Wednesday afternoon, I
trudged alone up to the house. There wasn’t a sign of life in it, and
when I rang at the hall door I heard the heavy bell clanging away
down the empty passages and cold servants’ quarters as in the
depths of an Egyptian tomb. I rang and rang, until at last I heard
shuffling footsteps approach. From the other side of the door came
stertorous breathing and wheezing, and the undoing of a chain; then
a burglar’s bell was taken off and fell with a jangle on the stone floor
inside, and at last the door was pulled ajar.
Poor old Crage! He looked out at me with his wicked, frightened
old face, pinched, haggard, unshaven, dirty; terror-struck, as though
he feared, I were Death himself who had been knocking at the door.
He was in his shirt and trousers and a frowzy old dressing-gown,
and his bare, bony feet were thrust in worn leather slippers. As he
breathed his throat rattled dismally, and his long hand, with the
thick, muddy veins, shook so he couldn’t fold the dressing-gown
round his gaunt, corded, bare throat.
“Hullo, young cockney!” he croaked; “what’s to do?”
“How are you, Mr. Crage?” I asked, shocked at the old man’s
fallen, forlorn look.
“Very bad!” he whispered, his rheumy eyes blinking with watery
self-pity.
“Is there anybody looking after you?”
“No—no—thieves! all thieves!—don’t want ’em.”
Then he made as if he would shut the door.
“I came up to see you on business,” I said; “about selling the
house.”
“No business to-day,” he croaked. “Too ill. Come to-morrow—any
time. Come to-morrow.” And with that he shut the door in my face.
I heard him shuffling away across the hall, kicking the fallen bell
with a tinkle along the floor, and then, as I turned to go, I heard him
fall and groan. I ran in hastily, and with great difficulty managed to
get him on his feet again. He stood there for some few minutes,
clutching me and rattling his throat; then, hanging on my arm,
dragging me along with him, he paddled off down a short dark
passage towards a half-open door, pushed it wide, and pulled me
after him into the great empty drawing-room.
The blinds were down, and the fading February sun gleamed in
on the bare worn carpet. In front of the fine fireplace, with a little
dying wood-fire in it, stood an arm-chair, with a small table beside it.
A candle and snuffers were on it, and a plate of stale bread-and-
butter. On the high mantel-piece was a medicine bottle, full and
corked.
He sank back into his chair, and lay there, breathing heavily, with
his eyes closed.
“But is there nobody looking after you?” I asked, and he made
some twitching movement with his fingers.
Just at that moment in flounced the gardener’s wife, drying her
hands on her apron. She was a big, handsome, shameless-looking
creature, with a naming eye and a hard, high color on her stiff
cheeks.
“Now you’ve been moving yourself about again!” she cried,
bending over him.
Crage opened his eyes and looked up at her maliciously.
“He came up on business,” he whispered.
“You’re a pretty man to do business, ain’t you?” she sneered.
“No, not to-day,” he mocked. “Too ill. All right to-morrow. Tell the
genelman to come to-morrow, early. Quite well to-morrow.”
I turned to go, and Crage, raising himself in his chair, rasped out:
“Bring the money with you, young cockney, or no business. Mind
that!”
The woman followed me to the door.
“Has he got a doctor?” I asked.
“Doctor Hall came once,” she said, “but he won’t do anything he
tells him. He won’t take his medicine and he won’t go to bed. He
says he’ll die if he goes to bed. He sleeps all night in that arm-chair
in the drawing-room. If he don’t die soon, I shall; I know that very
well. If you’ve got any business to do with him, you’d better come
early in the morning. He can’t last much longer.”
And with that she closed the door on me, and I heard her putting
up the chain again and the burglar’s bell as I went away down the
weedy gravel path.
CHAPTER XXIV

ARRIVAL OF BRENTIN—MY WEDDING-DAY—WE GO TO WHARTON


—BAILEY THOMPSON AND COCHEFORT FOLLOW US—WE
FINALLY DEFEAT THEM BOTH

Brentin was in “The French Horn” by a quarter to seven, and,


rather to my surprise, he came alone. I thought Hines or Masters
would surely have come with him; but no, he said, except for
Forsyth, they had all parted company at Southampton. Masters and
Miss Rybot had gone to Sea View, where they were to be married
almost immediately, and Hines had gone off to stay with a married
sister at Bournemouth. Forsyth alone had travelled up to town with
him, and then gone on straight to Colchester to take up his
neglected regimental duties. So I wrote out a telegram to be sent
first thing in the morning, begging him to come over and be my best
man.
And the boodle? Brentin winked and, with his hands on his
knees, began to laugh, like the priest in the Bonne Histoire.
“Some of it has melted, sir,” he joyously cried. “Your friend Hines
has got his, and Mr. Parsons, by this time, is toying with ay
registered letter way up in Southport. I have handsomely
recompensed Captain Evans and the crew; they have, no doubt,
been tanking-up and painting Portsmouth red all the time. I have
reimbursed myself for the yacht and other trifles, and there now
remains the £30,000 for your young lady’s ancestral home, and
some £20,000 for the hospitals and so on. To-morrow, sir, we will
draw up a list of the most deserving of them.”
“You have the money with you?”
“Yes,” he said; it was all safe in what he called his grip, or hand-
bag, and quite at my service. I told him of my desire to complete the
purchase immediately before the marriage was solemnized, and then
we fell to talking of Bailey Thompson and his strange silence.
“Why, the man is piqued, sir,” said Brentin; “that’s what he is,
piqued. Beyond saying that, I do not propose to give him ay second
thought. He is mad piqued, and that’s all there is to it!”
So I tried to feel completely at my ease, and managed to spend a
very happy evening in the bar parlor, Lucy playing to us and Brentin
occasionally bursting into raucous song. Now, when I think of him, I
like best to remember him as he was that evening, forgetting his
harder, commoner side, when he so outrageously proposed to desert
poor Teddy; even refusing (as I forgot at the time to mention) to
allow the cannon to be brought into play for his rescue by shelling
the rooms. He was infinitely gay and amusing, only finishing up the
evening, after dear Lucy’s retirement, with a long and violent dispute
with Mr. Thatcher on the vague subject of the immortality of the
soul. Thatcher believed he had a soul and would live forever, in
another, happier sphere; Brentin denied it, could see no sign of
Thatcher’s soul anywhere; so I left them trying to shout each other
down, both speaking at once.
I retired to rest with many solemn, touching thoughts. The last
night of bachelorhood gives rise to at least as much deep reflection
as that of the young maiden’s; more, in fact, so far as the bachelor
himself is concerned. I thought over it all so long and deeply I at last
got confused, and when I woke, the bright February sun was
streaming in on my best clothes and the bells from Nesshaven
Church were ringing.
All the morning those bells rang out their happy, irregular peal.
“The village church beneath the trees,
Where first our marriage vows were given,
With merry peal shall swell the breeze,
And point with slender spire to heaven!”

Only, to be exact, Nesshaven Church has no spire, but a sunk,


old, bird-haunted, ivy-clad tower.
It was Thatcher’s idea to set the bells going early and keep them
at it all day; you see, they rang not only for the marriage of his only
child, but for his return to their ancestral home; and, when they
showed any sign of flagging, Thatcher listened with a pained
expression, and cried, “Why, surely they’re not going to stop yet!
Run, Bobby, or Harriet, or George, my man!”—or whoever happened
to be handy—“and tell ’em to keep ’em going, and give ’em this from
me. Here, Vincent, my boy, have you got half-a-crown?”
By ten o’clock we were all dressed and ready, waiting only for
Forsyth. Soon after ten he came, and the procession started. It was
a lovely day again, mild and sunny, and, in true country-wedding
fashion, we all set out to walk. Lucy, looking perfectly sweet in gray,
was on her father’s arm, and the old lady, in black silk, on mine;
while Brentin, carrying his grip, with the boodle in it, and that good
little chap, Forsyth, brought up the rear.
The old lady, who within the last three months seemed to me to
have failed a good deal, mentally, at any rate, stepped out right well,
hanging lightly on my arm. At first she thought we were going
straight to the church, and couldn’t understand why we left it on our
right and went on up to the big house. Then she seemed to think it
quite natural, and that the place was hers again, and began talking
of her early days, when first she was married and came to Wharton
as a bride. Once or twice, indeed, she called me “Francis,” her
husband’s name, who died in 1850, and drew my attention to the
scandalous, weedy state of the walks.
“And this is what we pay good wages for!” she cried. “These men
must be spoken to about it, my dear, immediately.”
The gardener’s wife, who opened for us the hall door, was
astonished at our numbers.
“Why, what a crowd of you!” she said.
The old lady passed her haughtily.
“Come, Tom!” she cried to Mr. Thatcher. “We’ll go up-stairs and
have tea in my room. Come, Lucy!”
And up-stairs, up the bare stone staircase, they went, for, as I
whispered to Thatcher, it was just as well the ladies should be out of
the way while we did our business.
In the great empty drawing-room we found old Crage ready
waiting for us. He had dressed himself up in rusty attorney black for
the occasion, and the plain kitchen-table was neatly spread with
bundles of documents, title-deeds, and so forth.
As the woman showed us in, she told me he had been up all
night rummaging in his old tin boxes, talking and mumbling to
himself. Now he seemed quite spry and well again. I could scarcely
believe, as he sat there alert and attentive, he was the same
stricken, shambling old hunks I had seen the previous afternoon,
dragging himself about, senile and dying. Such is the power of the
will and the business instinct, prolonged even to the verge of the
grave!
Brentin, who, as usual, took everything into his own hands,
adopted the simplest method of dealing with him. Crage received us
in complete silence, and no one spoke a word, while Brentin opened
his grip and took out the notes and two or three little bags of gold.
The gold he emptied into heaps and piled them round the notes.
Then, “Thirty thousand pounds,” he said, with a smile—“thirty
thousand pounds! Is it a deal?”
Crage sat bolt upright, with his hand curved over his ear.
“For the entire property?” he asked.
“For the entire property. Is it a deal? Thirty thousand pounds,
neither less nor more.” And he emptied the grip and shook it, to
show that not a penny more remained.
“It’s worth more in the open market,” said Crage, cautiously.
“Then take it to the open market. We have no time to haggle. My
client is on his way to be married. Good-day.” And with that he
began to scrape the notes and gold together again.
“Hold hard!” cried Crage. “Don’t hurry an old man.”
“We’ll give the old man three minutes,” said Brentin, coolly
pulling out his watch.
We were all three of us grouped round the table, watching Crage,
with our backs to the door. The woman stood at his elbow, and we
could, in the complete silence, hear the heavy, swinging tick-tick of
Brentin’s large old-fashioned watch.
“Half time!” cried Brentin, when suddenly we heard steps outside
in the hall. I had just time to recognize Bailey Thompson’s even,
divisional tread, when he pushed the door open and stepped in. He
was dressed as usual, and behind him came a gentleman in a tight
black frock-coat, an evident Frenchman, thin, dark, and wiry, with a
withered face, like a preserved Bordeaux plum.
“One moment, if—you—please, gentlemen!” cried Bailey
Thompson, as he stepped up to the table.
My heart gave a bound, and Forsyth started and said, “Ho!” but
the unabashed Brentin merely politely replied, “One moment to you,
sir. We will attend to you directly.—Time’s up, Mr. Crage! is it or is it
not a deal?”
Bailey Thompson laughed. “Cool as ever, Mr. Brentin, I see,” he
said. “But don’t you think this amusing farce of yours has gone on
long enough? It has been successful so far, as I always thought it
would be!”
“You’re mighty good!”
“We have no desire to be unduly hard on you.”
“You are mighty particular good!”
“The Casino authorities are, on the whole, willing to regard you
as eccentric English gentlemen of position, who have played a very
cruel practical joke on them.”
“That so?”
“That is so. This is their representative, Mossieu Cochefort.”
“Enchantay!” cried Brentin, with a bow.
“He is charged to say that, on the due return of the money you
have sto—ahem!—carried off, and an undertaking from you in
writing that you none of you ever visit the place again, on any
pretence, they are willing to forego criminal proceedings, and no
further questions will be asked.”
“Oh, come off it!” cried Brentin, laughing.
“Otherwise,” continued Bailey Thompson, with great gravity, “I
must ask you, Mr. Blacker, and Mr. Forsyth here, to follow me to the
cab in waiting at the door, and return with us to London as our
prisoners.”
“In short, sir,” said Brentin, swelling with indignant importance,
“you invite us, eccentric gentlemen of recognized position, to
compound a felony!”
Thompson shrugged his shoulders, and Mossieu Cochefort looked
puzzled.
“Be ashamed of yourself, sir!” Brentin cried, his voice ringing
scornfully through the empty room. “Be ashamed of yourselves, you
and Mossieu Cochefort, and give over talking through your hat! Mr.
Crage, if you will write out a formal receipt we will look upon the
affair as settled. The formal transfer can be effected later.”
“Aye, aye!” mumbled Crage, and, with his eyes on the money,
began fumbling in the inside pocket of his rusty black coat for the
receipt.
“Gentlemen!” cried Thompson, with affected earnestness, “I warn
you! I very solemnly warn you—”
“Oh, come off it, Mr. Bailey Thompson, sir!” was Brentin’s
emphatic and withering reply; “come off it, and shut your head. We
have long had enough of you and your gas. For my part, my earnest
advice to you and Mossieu Cochefort is that you kiss yourselves
good-bye and go your several ways. And tell your amazing Casino
Company from us that the only undertaking we will give them is not
to come and do it again in the fall. To repeat a success is always
dangerous; and next time, no doubt, you will all be better prepared.
—Now, Mr. Crage, the receipt!”
“Qu’est ce qu’il a dit?” asked the puzzled Frenchman, as
Thompson, fuming and fretting, dragged him off to the window to
explain.
Meantime old Crage had produced his receipt, already written
and signed, and, handing it over, with trembling, eager fingers was
beginning to count the notes.
“Ten fifties—ten thousands—ten twenties,” he was mumbling,
“nice clean notes—beautiful crisp notes—he won’t get ’em back from
me, if that’s what he’s after! No, no, not from Crage. Crage wasn’t in
Clement’s Inn for forty years for nothing. Ten more fifties!—” So he
went on mumbling to himself, and stuffing the notes away in a
broken old pocket-book, while Brentin handed me over the receipt,
and snapped his grip with a click.
“It’s all right,” he whispered. “We’ve bluffed ’em. Keep cool.”
“Hadn’t you better let me keep ’em for you!” whined the woman,
bending over Crage’s chair. “You’ll only lose ’em. Give ’em me to take
care of for you, there’s a dearie!”
To which pathetic appeal the old man paid no sort of heed, but
pushed the pocket-book into his inside breast-pocket, with many
senile signs of satisfaction and joy.
“And now!” cried Brentin, in imperturbable high spirits, “the
wedding-procession will reform, and proceed to the church for the
tying of the sacred knot. Mr. Bailey Thompson—Mossieu Cochefort—
we shall be glad if you will join us, and afterwards, at ‘The French
Horn,’ to a slight but high-toned repast. Good-day, Mr. Crage; take
care of yourself and your money. Let us hope that when the robins
nest they will find you in your usual robust health. Mossieu Cochefort
—Mr. Bailey Thompson—if you will kindly follow us—”
But a sudden access of fury seemed to have seized the usually
calm little detective; he was stamping his feet, waving his arms,
almost foaming at the mouth.
In execrable French, Stratford-atte-Bow-Street French, he began
to swear aloud he would have nothing more to do with it, that he
had done his best, that he had never yet had dealings with the
French police but they hadn’t muddled it; for his part, his work was
finished, and he was going home.
“Here they are!” he cried, “three of them, all ready for you. Will
you have them, or won’t you? Les voilar! Nong? Vous ne les voulay
pas? Then if you don’t want them, why the ——” (dreadful bad
word!) “did you bring me off down here?” he yelled, breaking into
profane English.
“Mais, voyons! voyons!” murmured the startled and conciliatory
Cochefort.
“Damn your voyons!” Bailey Thompson screamed. “If you don’t
want them, and won’t take them, do the rest of it yourself, the best
way you can. I wash my hands of it. Good-day, gentlemen, and
thank your lucky stars for the imbecility of the French police!” and
with that he rushed to the door, through the hall, and out into his
cab. As he pulled the hall door open I heard the wedding-bells come
surging in with a new burst of joy.
“Mais, mon ami!” cried Cochefort, as Thompson tore himself
away, “ne me laissez pas comme ça!” and with much gesticulation
prepared to follow.
But Brentin sagely stopped him. “Restay, Mossieu Cochefort!” he
said, graciously; “Restay avec nous. Tout va biang. Restay!”
“Mais, quel cochon!” cried the angry Cochefort, stretching out his
black kid hands, and shaking them in Bailey Thompson’s direction.
“Ma parole d’honneur! a t’on jamais vu un pareil sacré cochon!”
“C’est vrai!” said Brentin. “Mais il est toujours comme ça. Vous
savvy, il n’est pas gentilhomme. Nous sommes tous gentilhommes.
Nous vous garderong et vous traiterong tray biang. Restay!”
So Mossieu Cochefort allowed himself to be comforted, and
restay’d. We took him with us to the church, and did him right well
at lunch, and then, so forlorn and downcast the poor creature
seemed, Lucy and I carried him off with us up to town, if only out of
kindness, to put him on his way back to Monaco.
On the way up in the train he confessed to me his only
instructions had been to try and get the money back, and that if he
couldn’t manage that, or part of it, he was directed not to think of
embarrassing the authorities by taking us all in charge. I could
conceive, he said, that the authorities didn’t want to be made the
laughing-stock of Europe by having to try us, nor to add to their
already heavy expenses by keeping us in prison—nearly all quite
young men—for the term of our natural lives. He hadn’t been able
fully to explain all this to Bailey Thompson: the man was such a
lunatic, he said, and so obstinate: and besides, from the moment of
his arrival Bailey Thompson had ridden the high horse over him, and
proudly declaring he didn’t require to be taught his duties by a
foreigner, had immediately carried him off down to Nesshaven,
scarcely allowing him once to open his mouth all the way.
At Liverpool Street he seemed more lost, poor wretch, than ever.
He knew no single word of English, and looked at us so pathetically,
as we stood on the platform together, our soft hearts were touched.
So we made up our minds to carry him along with us to Folkestone,
dine him at the “Pavilion,” and afterwards see him safe on board the
night-boat for Boulogne.
It was droll, all the same, this carrying a French detective about
with us on our wedding-day; but the man was so truly grateful I
have never regretted it. We gave him a good dinner at the hotel,
and at ten o’clock walked him out on to the pier for his boat. He
made me a little speech at parting, declaring I had treated him “en
vrai camarade,” and that if ever I wanted to come to Monte Carlo
again I was to let him know and he would see I came to no harm.
To Lucy he presented all his compliments and felicitations on
securing the affection of “un si galant homme!” and then, with a
twenty-pound note I slipped into his hand at parting, bowed himself
away, and was soon lost to sight in the purlieus of the second cabin,
whither he went prepared to be dreadfully sick, smooth and calm as
the night was.
As Lucy and I strolled back to the hotel, arm-in-arm, we both
were silent.
At last, just as we got back and heard the steamer’s final
clanging bell and despairing whistle, “I can’t make out, really,
whether you’ve all done right or wrong,” she whispered, softly; “but
this I know, dearest, you have been most extraordinarily lucky.”
To which simple little speech I merely pressed her arm, by way of
showing how thoroughly I agreed with her.
CONCLUSION
This is the true account of our raiding the tables at Monte Carlo,
done the best way I could.
For the rest, I may just mention poor old Crage died before the
end of the month, and by Easter Mr. Thatcher and his mother were
safely installed in Wharton Park. Arthur Masters was married to Miss
Rybot in April, Forsyth is to do the same to a widow (so he says) in
September, Bob Hines is very flourishing with his new gymnasium
and swimming-bath—just about finished now, as I write, at the end
of June—and Parsons is, I believe, at Southport, parading Lord
Street as usual in breeches and gaiters.
As for Brentin, I never saw him again, for by the time Lucy and I
had returned from our honeymoon he was back in New York. But I
heard from him the other day—a long, rambling letter, in which he
told me he had sold the Amaranth to Van Ginkel, for his wife the
Princess Danleno, whom he had remarried, and with whom, on
separate vessels, he was sailing about the Greek Archipelago—
probably in belated search for Bailey Thompson. He concluded by
begging me to think of something “snappy” we could do together in
the fall, ending finally by writing: “What’s the matter with our going
to Egypt and turning the Nile into the Red Sea? A communicative
stranger, an Englishman, by his accent, assures me there is just one
place where it can be done. Think it over, sonny, and if you decide to
do it, count on me. Sincerely, Julius C. Brentin.”
I would write more, only Lucy is calling to me from the hay-field,
the other side of the ha-ha of Wharton, where I have come to finish
this work in retirement.
“Around my ivied porch shall cling
Each fragrant flower that drinks the dew,
And Lucy at her wheel shall sing
In russet gown with ’kerchief blue.”

As my dear Lucy says, I really am, and always have been, a most
extraordinarily lucky man.
THE END
TRANSCRIBER NOTES
Misspelled words and printer errors have been corrected. Some
words are hyphenated by the author for emphasis.
Inconsistencies in punctuation have been maintained.
*** END OF THE PROJECT GUTENBERG EBOOK THE SACK OF
MONTE CARLO: AN ADVENTURE OF TO-DAY ***

Updated editions will replace the previous one—the old editions


will be renamed.

Creating the works from print editions not protected by U.S.


copyright law means that no one owns a United States
copyright in these works, so the Foundation (and you!) can copy
and distribute it in the United States without permission and
without paying copyright royalties. Special rules, set forth in the
General Terms of Use part of this license, apply to copying and
distributing Project Gutenberg™ electronic works to protect the
PROJECT GUTENBERG™ concept and trademark. Project
Gutenberg is a registered trademark, and may not be used if
you charge for an eBook, except by following the terms of the
trademark license, including paying royalties for use of the
Project Gutenberg trademark. If you do not charge anything for
copies of this eBook, complying with the trademark license is
very easy. You may use this eBook for nearly any purpose such
as creation of derivative works, reports, performances and
research. Project Gutenberg eBooks may be modified and
printed and given away—you may do practically ANYTHING in
the United States with eBooks not protected by U.S. copyright
law. Redistribution is subject to the trademark license, especially
commercial redistribution.

START: FULL LICENSE


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

You might also like