67% found this document useful (3 votes)
90 views

3303Starting Out With Programming Logic and Design, 6e 6th Edition Tony Gaddis - eBook PDFpdf download

The document provides information about the 6th edition of 'Starting Out with Programming Logic and Design' by Tony Gaddis, including links for downloading the eBook and other related titles. It emphasizes Pearson's commitment to diversity, equity, and inclusion in educational content. Additionally, it outlines the book's structure, including chapters covering various programming concepts and techniques.

Uploaded by

kefahsurla
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
67% found this document useful (3 votes)
90 views

3303Starting Out With Programming Logic and Design, 6e 6th Edition Tony Gaddis - eBook PDFpdf download

The document provides information about the 6th edition of 'Starting Out with Programming Logic and Design' by Tony Gaddis, including links for downloading the eBook and other related titles. It emphasizes Pearson's commitment to diversity, equity, and inclusion in educational content. Additionally, it outlines the book's structure, including chapters covering various programming concepts and techniques.

Uploaded by

kefahsurla
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 62

Starting Out With Programming Logic and Design,

6e 6th Edition Tony Gaddis - eBook PDF download

https://ebooksecure.com/download/starting-out-with-programming-
logic-and-design-6e-ebook-pdf/

Download more ebook from https://ebooksecure.com


We believe these products will be a great fit for you. Click
the link to download now, or visit ebooksecure.com
to discover even more!

(eBook PDF) Starting Out with Programming Logic and


Design 4th

http://ebooksecure.com/product/ebook-pdf-starting-out-with-
programming-logic-and-design-4th/

(eBook PDF) Starting Out with Java Early Objects 6th


Edition by Tony Gaddis

http://ebooksecure.com/product/ebook-pdf-starting-out-with-java-
early-objects-6th-edition-by-tony-gaddis/

Starting out with Visual C# 4th Edition by Tony Gaddis


(eBook PDF)

http://ebooksecure.com/product/starting-out-with-visual-c-4th-
edition-by-tony-gaddis-ebook-pdf/

(eBook PDF) Starting Out With Visual Basic 8th Edition


by Tony Gaddis

http://ebooksecure.com/product/ebook-pdf-starting-out-with-
visual-basic-8th-edition-by-tony-gaddis/
(eBook PDF) Starting out with Visual C# 4th Edition by
Tony Gaddis

http://ebooksecure.com/product/ebook-pdf-starting-out-with-
visual-c-4th-edition-by-tony-gaddis/

(eBook PDF) Starting Out With Visual Basic 7th Edition


by Tony Gaddis

http://ebooksecure.com/product/ebook-pdf-starting-out-with-
visual-basic-7th-edition-by-tony-gaddis/

Starting Out with C++: Early Objects 9th Edition by


Tony Gaddis (eBook PDF)

http://ebooksecure.com/product/starting-out-with-c-early-
objects-9th-edition-by-tony-gaddis-ebook-pdf/

(eBook PDF) Starting Out with Python (4th Edition)

http://ebooksecure.com/product/ebook-pdf-starting-out-with-
python-4th-edition/

Starting Out with Python 4th Edition (eBook PDF)

http://ebooksecure.com/product/starting-out-with-python-4th-
edition-ebook-pdf/
Sixth
Edition Starting Out with

Programming
Logic &
Design
This page intentionally left blank
Contents iii

Sixth
Edition Starting Out with

Programming
Logic &
Design

Tony Gaddis
Haywood Community College
Content Development: Dawn Murrin
Content Management: Tracy Johnson
Content Production: Ishan Chaudhary and Carole Snyder
Product Management: Holly Stark
Product Marketing: Wayne Stevens
Rights and Permissions: Anjali Singh
Please contact https://support.pearson.com/getsupport/s/ with any queries on this content.
Cover Image by Patrick de grijs/123RF.
Microsoft and/or its respective suppliers make no representations about the suitability of the information contained in the
documents and related graphics published as part of the services for any purpose. All such documents and related graphics
are provided “as is” without warranty of any kind. Microsoft and/or its respective suppliers hereby disclaim all warranties
and conditions with regard to this information, including all warranties and conditions of merchantability, whether express,
implied or statutory, fitness for a particular purpose, title and non-infringement. In no event shall Microsoft and/or its
respective suppliers be liable for any special, indirect or consequential damages or any damages whatsoever resulting from
loss of use, data or profits, whether in an action of contract, negligence or other tortious action, arising out of or in
connection with the use or performance of information available from the services.
The documents and related graphics contained herein could include technical inaccuracies or typographical errors. Changes
are periodically added to the information herein. Microsoft and/or its respective suppliers may make improvements and/or
changes in the product(s) and/or the program(s) described herein at any time. Partial screen shots may be viewed in full
within the software version specified.
Microsoft® and Windows® are registered trademarks of the Microsoft Corporation in the U.S.A. and other countries. This
book is not sponsored or endorsed by or affiliated with the Microsoft Corporation.
Copyright © 2023, 2019 by Pearson Education, Inc. or its affiliates, 221 River Street, Hoboken, NJ 07030. All Rights
Reserved. Manufactured in the United States of America. This publication is protected by copyright, and permission should
be obtained from the publisher prior to any prohibited reproduction, storage in a retrieval system, or transmission in any
form or by any means, electronic, mechanical, photocopying, recording, or otherwise. For information regarding
permissions, request forms, and the appropriate contacts within the Pearson Education Global Rights and Permissions
department, please visit www.pearsoned.com/permissions/.
Acknowledgments of third-party content appear on the appropriate page within the text.
PEARSON is exclusive trademarks owned by Pearson Education, Inc. or its affiliates in the U.S. and/or other countries.
Unless otherwise indicated herein, any third-party trademarks, logos, or icons that may appear in this work are the property
of their respective owners, and any references to third-party trademarks, logos, icons, or other trade dress are for
demonstrative or descriptive purposes only. Such references are not intended to imply any sponsorship, endorsement,
authorization, or promotion of Pearson’s products by the owners of such marks, or any relationship between the owner and
Pearson Education, Inc., or its affiliates, authors, licensees, or distributors.

Library of Congress Cataloging-in-Publication Data


Starting Out with Programming Logic & Design
Library of Congress Cataloging in Publication Control Number: 2021057225

ScoutAutomatedPrintCode
Rental:
ISBN-10: 0-13-760214-6
ISBN-13: 978-0-13-760214-8
Print offer:
ISBN-10: 0-13-760191-3
ISBN-13: 978-0-13-760191-2
Contents v

Pearson’s Commitment
to Diversity, Equity,
and Inclusion

Pearson is dedicated to creating bias-free content that reflects the diversity,


depth, and breadth of all learners’ lived experiences.

We embrace the many dimensions of diversity, including but not limited to race, ethnicity, gender,
sex, sexual orientation, socioeconomic status, ability, age, and religious or political beliefs.

Education is a powerful force for equity and change in our world. It has the potential to deliver
opportunities that improve lives and enable economic mobility. As we work with authors to create
content for every product and service, we acknowledge our responsibility to demonstrate inclusivity
and incorporate diverse scholarship so that everyone can achieve their potential through learning.
As the world’s leading learning company, we have a duty to help drive change and live up to our
purpose to help more people create a better life for themselves and to create a better world.

Our ambition is to purposefully contribute to a world where:


• Everyone has an equitable and lifelong opportunity • Our educational products and services are inclusive
to succeed through learning. and represent the rich diversity of learners.
• Our educational content accurately reflects the • Our educational content prompts deeper
histories and lived experiences of the learners discussions with students and motivates them to
we serve. expand their own learning (and worldview).

Accessibility Contact Us
We are also committed to providing products that While we work hard to present unbiased, fully
are fully accessible to all learners. As per Pearson’s accessible content, we want to hear from you about
guidelines for accessible educational Web media, any concerns or needs with this Pearson product so
we test and retest the capabilities of our products that we can investigate and address them.
against the highest standards for every release,
Please contact us with concerns about any
following the WCAG guidelines in developing new
potential bias at
products for copyright year 2022 and beyond.
https://www.pearson.com/report-bias.html
You can learn more about Pearson’s
For accessibility-related issues, such as using
commitment to accessibility at
assistive technology with Pearson products,
https://www.pearson.com/us/accessibility.html
alternative text requests, or accessibility
documentation, email the Pearson Disability Support
team at [email protected]
vi Contents

Brief Contents

Preface xiii
Acknowledgments xxi
About the Author xxv
Chapter 1 Introduction to Computers and Programming 1
Chapter 2 Input, Processing, and Output 27
Chapter 3 Decision Structures and Boolean Logic 103
Chapter 4 Repetition Structures 161
Chapter 5 Modules 227
Chapter 6 Functions 285
Chapter 7 Input Validation 335
Chapter 8 Arrays 353
Chapter 9 Sorting and Searching Arrays 419
Chapter 10 Files 469
Chapter 11 Menu-Driven Programs 543
Chapter 12 Text Processing 595
Chapter 13 Recursion 623
Chapter 14 Object-Oriented Programming 649
Chapter 15 GUI Applications and Event-Driven Programming 715
Appendix A ASCII/Unicode Characters 747
Appendix B Flowchart Symbols 749
Appendix C Pseudocode Reference 751
Appendix D Converting Decimal Numbers to Binary 765
Appendix E Answers to Checkpoint Questions 767
Index 783
vi
Contents vii

Contents

Preface xiii
Acknowledgments xxi
About the Author xxv

Chapter 1 Introduction to Computers and Programming 1


1.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.2 Hardware . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
1.3 How Computers Store Data. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
1.4 How a Program Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
1.5 Types of Software . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
Review Questions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21

Chapter 2 Input, Processing, and Output 27


2.1 Designing a Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
2.2 Output, Input, and Variables. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
2.3 Variable Assignment and Calculations . . . . . . . . . . . . . . . . . . . . . . . . . . 43
IN THE SPOTLIGHT: Calculating Cell Phone Overage Fees . . . . . . . . . . . . . . . . . . 47
IN THE SPOTLIGHT: Calculating a Percentage . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
IN THE SPOTLIGHT: Calculating an Average . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
IN THE SPOTLIGHT: Converting a Math Formula to a Programming Statement. . . 55
2.4 Variable Declarations and Data Types. . . . . . . . . . . . . . . . . . . . . . . . . . . 57
2.5 Named Constants . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
2.6 Hand Tracing a Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64
2.7 Documenting a Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
IN THE SPOTLIGHT: Using Named Constants, Style Conventions,
and Comments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66
2.8 Designing Your First Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68
2.9 Focus on Languages: Java, Python, and C++ . . . . . . . . . . . . . . . . . . . . . . 72
Review Questions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92
Debugging Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97
Programming Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98

vii
viii Contents

Chapter 3 Decision Structures and Boolean Logic 103


3.1 Introduction to Decision Structures . . . . . . . . . . . . . . . . . . . . . . . . . . . 103
IN THE SPOTLIGHT: Using the If-Then Statement . . . . . . . . . . . . . . . . . . . . . . 110
3.2 Dual Alternative Decision Structures . . . . . . . . . . . . . . . . . . . . . . . . . . . 113
IN THE SPOTLIGHT: Using the If-Then-Else Statement . . . . . . . . . . . . . . . . . 114
3.3 Comparing Strings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118
3.4 Nested Decision Structures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122
IN THE SPOTLIGHT: Multiple Nested Decision Structures . . . . . . . . . . . . . . . . . 125
3.5 The Case Structure. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129
IN THE SPOTLIGHT: Using a Case Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132
3.6 Logical Operators. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 134
3.7 Boolean Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141
3.8 Focus on Languages: Java, Python, and C++ . . . . . . . . . . . . . . . . . . . . . 142
Review Questions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 154
Debugging Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 158
Programming Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 158

Chapter 4 Repetition Structures 161


4.1 Introduction to Repetition Structures . . . . . . . . . . . . . . . . . . . . . . . . . . 161
4.2 Condition-Controlled Loops: While, Do-While, and Do-Until . . . . 162
IN THE SPOTLIGHT: Designing a While Loop . . . . . . . . . . . . . . . . . . . . . . . . . . 167
IN THE SPOTLIGHT: Designing a Do-While Loop . . . . . . . . . . . . . . . . . . . . . . . 174
4.3 Count-Controlled Loops and the For Statement . . . . . . . . . . . . . . . . . 179
IN THE SPOTLIGHT: Designing a Count-Controlled Loop
with the For Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189
4.4 Calculating a Running Total . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 199
4.5 Sentinels . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 203
IN THE SPOTLIGHT: Using a Sentinel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 204
4.6 Nested Loops . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 207
4.7 Focus on Languages: Java, Python, and C++ . . . . . . . . . . . . . . . . . . . . . 210
Review Questions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 219
Debugging Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 222
Programming Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 223

Chapter 5 Modules 227


5.1 Introduction to Modules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 227
5.2 Defining and Calling a Module . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 230
IN THE SPOTLIGHT: Defining and Calling Modules . . . . . . . . . . . . . . . . . . . . . . 239
5.3 Local Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 244
5.4 Passing Arguments to Modules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 247
IN THE SPOTLIGHT: Passing an Argument to a Module . . . . . . . . . . . . . . . . . . . 251
Contents ix

IN THE SPOTLIGHT: Passing an Argument by Reference . . . . . . . . . . . . . . . . . . . 257


5.5 Global Variables and Global Constants . . . . . . . . . . . . . . . . . . . . . . . . 260
IN THE SPOTLIGHT: Using Global Constants . . . . . . . . . . . . . . . . . . . . . . . . . . . 261
5.6 Focus on Languages: Java, Python, and C++ . . . . . . . . . . . . . . . . . . . . . 265
Review Questions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 276
Debugging Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 280
Programming Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 281

Chapter 6 Functions 285


6.1 Introduction to Functions: Generating Random Numbers . . . . . . . . . . 285
IN THE SPOTLIGHT: Using Random Numbers . . . . . . . . . . . . . . . . . . . . . . . . . . 289
IN THE SPOTLIGHT: Using Random Numbers to Represent Other Values . . . . . 292
6.2 Writing Your Own Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 294
IN THE SPOTLIGHT: Modularizing with Functions . . . . . . . . . . . . . . . . . . . . . . . 300
6.3 More Library Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 309
6.4 Focus on Languages: Java, Python, and C++ . . . . . . . . . . . . . . . . . . . . . 319
Review Questions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 326
Debugging Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 329
Programming Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 330

Chapter 7 Input Validation 335


7.1 Garbage In, Garbage Out . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 335
7.2 The Input Validation Loop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 336
IN THE SPOTLIGHT: Designing an Input Validation Loop . . . . . . . . . . . . . . . . . 338
7.3 Defensive Programming . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 343
7.4 Focus on Languages: Java, Python, and C++ . . . . . . . . . . . . . . . . . . . . . 344
Review Questions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 348
Debugging Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 350
Programming Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 351

Chapter 8 Arrays 353


8.1 Array Basics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 353
IN THE SPOTLIGHT: Using Array Elements in a Math Expression . . . . . . . . . . . 360
8.2 Sequentially Searching an Array . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 367
8.3 Processing the Contents of an Array . . . . . . . . . . . . . . . . . . . . . . . . . . . 373
IN THE SPOTLIGHT: Processing an Array . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 380
8.4 Parallel Arrays . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 387
IN THE SPOTLIGHT: Using Parallel Arrays . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 388
8.5 Two-Dimensional Arrays . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 392
IN THE SPOTLIGHT: Using a Two-Dimensional Array . . . . . . . . . . . . . . . . . . . . 395
8.6 Arrays of Three or More Dimensions . . . . . . . . . . . . . . . . . . . . . . . . . . . 399
x Contents

8.7 Focus on Languages: Java, Python, and C++ . . . . . . . . . . . . . . . . . . . . . 401


Review Questions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 411
Debugging Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 414
Programming Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 415

Chapter 9 Sorting and Searching Arrays 419


9.1 The Bubble Sort Algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 419
IN THE SPOTLIGHT: Using the Bubble Sort Algorithm . . . . . . . . . . . . . . . . . . . . 426
9.2 The Selection Sort Algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 433
9.3 The Insertion Sort Algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 439
9.4 The Binary Search Algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 445
IN THE SPOTLIGHT: Using the Binary Search Algorithm . . . . . . . . . . . . . . . . . . . 449
9.5 Focus on Languages: Java, Python, and C++ . . . . . . . . . . . . . . . . . . . . . 451
Review Questions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 464
Debugging Exercise. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 467
Programming Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 467

Chapter 10 Files 469


10.1 Introduction to File Input and Output . . . . . . . . . . . . . . . . . . . . . . . . . 469
10.2 Using Loops to Process Files. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 481
IN THE SPOTLIGHT: Working with Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 486
10.3 Using Files and Arrays . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 490
10.4 Processing Records . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 491
IN THE SPOTLIGHT: Adding and Displaying Records . . . . . . . . . . . . . . . . . . . . . 496
IN THE SPOTLIGHT: Searching for a Record . . . . . . . . . . . . . . . . . . . . . . . . . . . . 500
IN THE SPOTLIGHT: Modifying Records . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 502
IN THE SPOTLIGHT: Deleting Records . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 506
10.5 Control Break Logic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 509
IN THE SPOTLIGHT: Using Control Break Logic . . . . . . . . . . . . . . . . . . . . . . . . . 510
10.6 Focus on Languages: Java, Python, and C++ . . . . . . . . . . . . . . . . . . . . . 516
Review Questions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 536
Debugging Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 539
Programming Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 540

Chapter 11 Menu-Driven Programs 543


11.1 Introduction to Menu-Driven Programs . . . . . . . . . . . . . . . . . . . . . . . . 543
11.2 Modularizing a Menu-Driven Program . . . . . . . . . . . . . . . . . . . . . . . . . 554
11.3 Using a Loop to Repeat the Menu . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 559
IN THE SPOTLIGHT: Designing a Menu-Driven Program . . . . . . . . . . . . . . . . . . 564
11.4 Multiple-Level Menus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 578
11.5 Focus on Languages: Java, Python, and C++ . . . . . . . . . . . . . . . . . . . . . 584
Contents xi

Review Questions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 590


Programming Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 592

Chapter 12 Text Processing 595


12.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 595
12.2 Character-by-Character Text Processing . . . . . . . . . . . . . . . . . . . . . . . . 597
IN THE SPOTLIGHT: Validating a Password . . . . . . . . . . . . . . . . . . . . . . . . . . . . 600
IN THE SPOTLIGHT: Formatting and Unformatting Telephone Numbers . . . . . . 606
12.3 Focus on Languages: Java, Python, and C++ . . . . . . . . . . . . . . . . . . . . . 611
Review Questions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 617
Debugging Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 619
Programming Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 620

Chapter 13 Recursion 623


13.1 Introduction to Recursion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 623
13.2 Problem Solving with Recursion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 626
13.3 Examples of Recursive Algorithms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 630
13.4 Focus on Languages: Java, Python, and C++ . . . . . . . . . . . . . . . . . . . . . 640
Review Questions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 645
Programming Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 647

Chapter 14 Object-Oriented Programming 649


14.1 Procedural and Object-Oriented Programming. . . . . . . . . . . . . . . . . . . 649
14.2 Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 653
14.3 Using the Unified Modeling Language to Design Classes . . . . . . . . . . . 664
14.4 Finding the Classes and Their Responsibilities in a Problem . . . . . . . . . 667
IN THE SPOTLIGHT: Finding the Classes in a Problem . . . . . . . . . . . . . . . . . . . . 667
IN THE SPOTLIGHT: Determining Class Responsibilities . . . . . . . . . . . . . . . . . . . 671
14.5 Inheritance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 677
14.6 Polymorphism . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 685
14.7 Focus on Languages: Java, Python, and C++ . . . . . . . . . . . . . . . . . . . . . 689
Review Questions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 707
Programming Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 710

Chapter 15 GUI Applications and Event-Driven


Programming 715
15.1 Graphical User Interfaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 715
15.2 Designing the User Interface for a GUI Program . . . . . . . . . . . . . . . . . . 718
IN THE SPOTLIGHT: Designing a Window . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 723
15.3 Writing Event Handlers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 725
xii Contents

IN THE SPOTLIGHT:Designing an Event Handler . . . . . . . . . . . . . . . . . . . . . . . . 728


15.4 Designing Apps for Mobile Devices . . . . . . . . . . . . . . . . . . . . . . . . . . . . 731
15.5 Focus on Languages: Java, Python, and C++ . . . . . . . . . . . . . . . . . . . . . 740
Review Questions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 741
Programming Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 744

Appendix A ASCII/Unicode Characters 747


Appendix B Flowchart Symbols 749
Appendix C Pseudocode Reference 751
Appendix D Converting Decimal Numbers to Binary 765
Appendix E Answers to Checkpoint Questions 767

Index 783
Contents xiii

Preface

W
elcome to Starting Out with Programming Logic and Design, Sixth Edition.
This book uses a language-independent approach to teach programming
concepts and problem-solving skills, without assuming any previous pro-
gramming experience. By using easy-to-understand pseudocode, flowcharts, and other
tools, the student learns how to design the logic of programs without the complication
of language syntax.
Fundamental topics such as data types, variables, input, output, control structures,
modules, functions, arrays, and files are covered as well as object-oriented concepts,
GUI development, and event-driven programming. As with all the books in the Starting
Out with . . . series, this text is written in clear, easy-to-understand language that stu-
dents find friendly and inviting.
Each chapter presents a multitude of program design examples. Short examples that
highlight specific programming topics are provided, as well as more involved examples
that focus on problem solving. Each chapter includes at least one In the Spotlight
section that provides step-by-step analysis of a specific problem and demonstrates a
solution to that problem.
This book is ideal for a programming logic course that is taught as a precursor to a
language-specific introductory programming course, or for the first part of an intro-
ductory programming course in which a specific language is taught.

Changes in the Sixth Edition


Previous editions of this book introduced modules, which are procedures that do not
return a value, in Chapter 3. Feedback from adopters and reviewers indicate that stu-
dents sometimes have trouble learning about modules before they have been exposed
to control structures, such as If statements and loops. In this edition, the chapter on
modules has been moved to Chapter 5. Now, the students will learn about control
structures, then modules, and then value-returning functions. This improved pedagogy
gradually introduces the students to the different ways a program’s flow of execution
can be directed.

Brief Overview of Each Chapter


Chapter 1: Introduction to Computers and Programming
This chapter begins by giving a concise and easy-to-understand explanation of how
computers work, how data is stored and manipulated, and why we write programs in
high-level languages.

xiii
xiv Preface

Chapter 2: Input, Processing, and Output


This chapter introduces the program development cycle, data types, variables, and
sequence structures. The student learns to use pseudocode and flowcharts to design
simple programs that read input, perform mathematical operations, and produce
screen output.

Chapter 3: Decision Structures and Boolean Logic


In this chapter students explore relational operators and Boolean expressions and are
shown how to control the flow of a program with decision structures. The If-Then,
If-Then-Else, and If-Then-Else If statements are covered. Nested decision struc-
tures, logical operators, and the case structure are also discussed.

Chapter 4: Repetition Structures


This chapter shows the student how to use loops to create repetition structures. The
While, Do-While, Do-Until, and For loops are presented. Counters, accumulators,
running totals, and sentinels are also discussed.

Chapter 5: Modules
This chapter demonstrates the benefits of modularizing programs and using the top-
down design approach. The student learns to define and call modules, pass arguments
to modules, and use local variables. Hierarchy charts are introduced as a design tool.

Chapter 6: Functions
This chapter begins by discussing common library functions, such as those for generat-
ing random numbers. After learning how to call library functions and how to use val-
ues returned by functions, the student learns how to define and call his or her own
functions.

Chapter 7: Input Validation


This chapter discusses the importance of validating user input. The student learns to
write input validation loops that serve as error traps. Defensive programming and the
importance of anticipating obvious as well as unobvious errors is discussed.

Chapter 8: Arrays
In this chapter the student learns to create and work with one- and two-dimensional
arrays. Many examples of array processing are provided including examples illustrat-
ing how to find the sum, average, and highest and lowest values in an array, and how
to sum the rows, columns, and all elements of a two-dimensional array. Programming
techniques using parallel arrays are also demonstrated.

Chapter 9: Sorting and Searching Arrays


In this chapter the student learns the basics of sorting arrays and searching for data
stored in them. The chapter covers the bubble sort, selection sort, insertion sort, and
binary search algorithms.
Preface xv

Chapter 10: Files


This chapter introduces sequential file input and output. The student learns to read and
write large sets of data, store data as fields and records, and design programs that work
with both files and arrays. The chapter concludes by discussing control break processing.

Chapter 11: Menu-Driven Programs


In this chapter the student learns to design programs that display menus and execute
tasks according to the user’s menu selection. The importance of modularizing a menu-
driven program is also discussed.

Chapter 12: Text Processing


This chapter discusses text processing at a detailed level. Algorithms that step through
the individual characters in a string are discussed, and several common library func-
tions for character and text processing are introduced.

Chapter 13: Recursion


This chapter discusses recursion and its use in problem solving. A visual trace of recur-
sive calls is provided, and recursive applications are discussed. Recursive algorithms
for many tasks are presented, such as finding factorials, finding a greatest common
denominator (GCD), summing a range of values in an array, and performing a binary
search. The classic Towers of Hanoi example is also presented.

Chapter 14: Object-Oriented Programming


This chapter compares procedural and object-oriented programming practices. It cov-
ers the fundamental concepts of classes and objects. Fields, methods, access specifica-
tion, constructors, accessors, and mutators are discussed. The student learns how to
model classes with UML and how to find the classes in a particular problem.

Chapter 15: GUI Applications and Event-Driven Programming


This chapter discusses the basic aspects of designing a GUI application. Building graph-
ical user interfaces with visual design tools (such as Visual Studio® or NetBeans™) is
discussed. The student learns how events work in a GUI application and how to write
event handlers.

Appendix A: ASCII/Unicode Characters


This appendix lists the ASCII character set, which is the same as the first 127 Unicode
character codes.

Appendix B: Flowchart Symbols


This appendix shows the flowchart symbols that are used in this book.

Appendix C: Pseudocode Reference


This appendix provides a quick reference for the pseudocode language that is used in
the book.
xvi Preface

Appendix D: Converting Decimal Numbers to Binary


This appendix uses a simple tutorial to demonstrate how to convert a decimal number
to binary.

Appendix E: Answers to Checkpoint Questions


This appendix provides answers to the Checkpoint questions that appear throughout
the text.

Organization of the Text


The text teaches programming logic and design in a step-by-step manner. Each chapter
covers a major set of topics and builds knowledge as students progress through the
book. Although the chapters can be easily taught in their existing sequence, there is
some flexibility. Figure P-1 shows chapter dependencies. Each box represents a chapter
or a group of chapters. A chapter to which an arrow points must be covered before the
chapter from which the arrow originates. The dotted line indicates that only a portion
of Chapter 10 depends on information presented in Chapter 8.

Features of the Text


Concept Statements. Each major section of the text starts with a concept state-
ment. This statement concisely summarizes the main point of the section.
Example Programs. Each chapter has an abundant number of complete and partial
example programs, each designed to highlight the current topic. Pseudocode, flow-
charts, and other design tools are used in the example programs.
In the Spotlight. Each chapter has one or
more In the Spotlight case studies that provide
detailed, step-by-step analysis of problems, and
show the student how to solve them.
Preface xvii

Figure P-1 Chapter dependencies

Chapters 1–6
(Cover in Order)

Depend On

Chapter 15
Chapter 7 GUI Applications and
Input Validation Event-Driven
Programming

Chapter 8 Chapter 10 Chapter 13


Arrays Files Recursion
Some Topics in
Chapter 10 Depend on
Chapter 8
Chapter 11 Chapter 14
Menu-Driven Object-Oriented
Programs Programming
Depend on

Chapter 9
Chapter 12
Sorting and Searching
Text Processing
Arrays

VideoNotes. A series of online videos, developed specifically for this book, are avail-
able for viewing at www.pearson.com/cs-resources. Icons appear throughout the
VideoNote
text alerting the student to videos about specific topics.

NOTE: Notes appear at several places throughout the text. They are short explana-
tions of interesting or often misunderstood points relevant to the topic at hand.

TIP: Tips advise the student on the best techniques for approaching different pro-
gramming or animation problems.

WARNING! Warnings caution students about programming techniques or prac-


tices that can lead to malfunctioning programs or lost data.
xviii Preface

Programming Language Companions. Many of the pseudocode programs


shown in this book have also been written in Java, Python, and C++. These programs
appear in the programming language companions that are available at www.pear-
son.com/cs-resources. Icons appear next to each pseudocode program that also
appears in the language companions.
Checkpoints. Checkpoints are questions placed at intervals throughout each chapter.
They are designed to query the student’s knowledge quickly after learning a new topic.
Review Questions. Each chapter presents a thorough and diverse set of Review
Questions and exercises. They include Multiple Choice, True/False, Short Answer, and
Algorithm Workbench.
Debugging Exercises. Most chapters provide a set of Debugging Exercises in which
the student examines a set of pseudocode algorithms and identifies logical errors.
Programming Exercises. Each chapter offers a pool of Programming Exercises
designed to solidify the student’s knowledge of the topics currently being studied.

Supplements
Student Online Resources
Many student resources are available for this book from the publisher. The following
items are available on the Gaddis Series resource page at www.pearson.com/cs-
resources:

●● Access to the book’s companion VideoNotes


An extensive series of online VideoNotes have been developed to accompany this
text. Throughout the book, VideoNote icons alert the student to videos covering
specific topics. Additionally, one programming exercise at the end of each chapter
has an accompanying VideoNote explaining how to develop the problem’s solution.

●● Access to the Language Companions for Python, Java, and C++


Programming language companions specifically designed to accompany this text-
book are available for download. The companions introduce the Java™, Python®,
and C++ programming languages, and correspond on a chapter-by-chapter basis
with the textbook. Many of the pseudocode programs that appear in the text-
book also appear in the companions, implemented in a specific programming
language.

●● A link to download the Flowgorithm flowcharting application


Flowgorithm is a free application, developed by Devin Cook at Sacramento State
University, which allows you to create programs using simple flowcharts. It sup-
ports the flowcharting conventions used in this textbook, as well as several other
standard conventions. When you create a flowchart with Flowgorithm, you can
execute the program and generate Gaddis Pseudocode. You can also generate
source code in Java, Python, Visual Basic, C#, Ruby, JavaScript, and several other
languages. For more information, see www.flowgorithm.org.
Preface xix

●● A link to download the RAPTOR flowcharting environment


RAPTOR is a flowchart-based programming environment developed by the US
Air Force Academy Department of Computer Science. For more information, see
https://raptor.martincarlisle.com.

Instructor Resources
The following supplements are available to qualified instructors only:

●● Answers to all of the Review Questions


●● Solutions for the Programming Exercises
●● PowerPoint® presentation slides for each chapter
●● Test bank

Visit the Pearson Instructor Resource Center www.pearson.com or contact your local
Pearson representative for information on how to access them.
This page intentionally left blank
Acknowledgments

There have been many helping hands in the development and publication of this text.
I would like to thank the following faculty reviewers:

Reviewers for This Edition


Taz Daughtrey
Central Virginia Community College
Donna Sandsmark
University of California, San Diego
Holly Tajlil
Sacramento State University
Deborah Wilson
Ashland University

Reviewers of Previous Editions


Reni Abraham
Houston Community College
Alan Anderson
Gwinnett Technical College
Cherie Aukland
Thomas Nelson Community College
Steve Browning
Freed Hardeman University
John P. Buerck
Saint Louis University
Jill Canine
Ivy Tech Community College of Indiana
Tony Cantrell
Georgia Northwestern Technical College
Steven D. Carver
Ivy Tech Community College
Stephen Robert Cheskiewicz
Keystone College and Wilkes University
Katie Danko
Grand Rapids Community College

xxi
xxii Acknowledgments

Richard J. Davison
College of the Albemarle
Sameer Dutta
Grambling State University
Norman P. Hahn
Thomas Nelson Community College
John Haley
Athens Technical College
Keith Hallmark
Calhoun Community College
Ronald J. Harkins
Miami University, OH
Dianne Hill
Jackson College
Vai Kumar
Pensacola State College
Coronicca Oliver
Coastal Georgia Community College
Robert S. Overall, III
Nashville State Community College
Dale T. Pickett
Baker College of Clinton Township
Tonya Pierce
Ivy Tech Community College
J. Shawn Pope
Tulsa Community College
Maryam Rahnemoonfar
Texas A&M University
Linda Reeser
Arizona Western College
Homayoun Sharafi
Prince George’s Community College
Emily Shepard
Central Carolina Community College
Larry Strain
Ivy Tech Community College–Bloomington
Donald Stroup
Ivy Tech Community College
Acknowledgments xxiii

John Thacher
Gwinnett Technical College
Jim Turney
Austin Community College
Scott Vanselow
Edison State College
I would like to thank the faculty, staff, and administration at Haywood Community
College for the opportunity to build a career teaching the subjects that I love. I would
also like to thank my family and friends for their support in all my projects.
It is a great honor to be published by Pearson, and I am extremely fortunate to have
Tracy Johnson as my Content Manager. She and her colleagues Holly Stark, Erin
Sullivan, Sandra Rodriguez, Wayne Stevens, Scott Disanno, Bob Engelhardt, Ishan
Chaudhary, Carole Snyder, and Mahalakshmi Usha have worked tirelessly to produce
and promote this book. Thanks to you all!
This page intentionally left blank
Another Random Document on
Scribd Without Any Related Topics
o’clock, we continued our walk in and about and all around, until, much to
our surprise, we were taken into a cool, big courtyard, up a wide flight of
worn stone steps into the señor’s home. There we met his wife and children,
listened to beautiful native dances sympathetically played on the piano by
the señor; we rocked in the ever-present Vienna bent-wood chair, talked to
the parrot, played with the baby, and drank cocoanut milk from the green
cocoanut, and lived to drink from many more. The cocoanut, when used for
milk by these Southern people, is cut quite green, before the solid meat has
formed and when all is liquid within, and is said to be most healthful. Of
our party, the adventurous man and children liked it very much, but the
cautious woman a very little. Then we made our adieux, not without the
promise, however, that the señor would meet us at three o’clock for the trip
up the Ozama River in the ship’s boats.
All day the clouds were reeling heavily in bulky, black heaps, now and
then dropping down upon our innocent heads torrents of spattering rain. But
we were not to be discomfited by a rain-shower, for were we not prepared?
We left the ship with but one umbrella, the white one with the green lining,
but as we bade the señor “Adios,” a sudden shower called forth his best silk
umbrella. He was insistent, and there was nothing to do but for Daddy to
tuck Sister under his wing, accepting the señor’s offer, and for Little Blue
Ribbons to trot along by my side, under the Haïtien umbrella. And the green
lining proved fast green; it did not run, not a particle!

Looking across the Plaza


Santo Domingo
By three o’clock, Domingo City was a veritable Port Tarascon, and it
seemed that Daudet must have been here before he wrote of his poor
drenched French émigrés. The rain still fell. It ran down the streets
anywhere it pleased; it dripped off the ruined roof of Diego’s Palace; it
scampered down the awning of the German Legation; it stood in little pools
on the terrace overlooking the river; it trickled down the face of the timeless
old sun-dial, and made the long seams on its face dark and wet, as if from
tears.
What bliss if we could only have set our watches by the hour told on the
Dominican sun-dial! But there was no sun and consequently no time.
I have an inspiration! It has just come to me. Now my course is plain;
now I know what I shall do with the little girls. I have often longed to
obliterate for them the thought of time. I have wanted them to grow into a
feeling of possession of all the time there ever can be,—countless ages and
ages of time, with never a shadow of hurry lurking about; with never a
doubt but that the days will be long enough in which to live their fullest
measure of happiness. I shall invoke the aid of the gods, in whose arms
rests so peacefully this “Island of the Blest,” and they shall build for me an
enchanted palace somewhere,—perhaps not just here, but somewhere. I
think I shall leave that to the little girls, but it shall be an enchanted palace,
all overgrown with sweetbrier and moss, and roundabout shall be a garden
—a dear garden, with violets and lilies and arbutus and anemones—and
then the trees,—there shall be no end of them!—maple and ash, and slender
birch and elm, and linden and—but it seems to me I hear you wondering
that we should leave out the palms and the breadfruit and banana and citron.
I know it does not seem just as it should be, but I am afraid, if we had the
palms and the breadfruit, we’d never feel really at home in our palace, and,
of course, we must feel at home even in an enchanted palace. We could
have two palaces if we wanted to, and have the palms in the company
palace, and the cool, sweet maples we could have for our very own. Yes,
that is it! That’s what we’ll do!
In the midst of the garden, we will have a Dominican sun-dial, an exact
reproduction of this one. I shall make a sketch of it before we move a step
further, and it shall he chipped and worn and sun-baked and tear-stained,
and it shall look centuries old. Then there must be a Dominican sky; half-
sun and half-shade. And then, don’t you see, the little girls will never know
the time at all,—only just as the clouds run off for a frolic. And I shall
arrange an indefinite supply of such weather, and that’s just where we’ll all
live. Yes—Daddy and all the dear ones, and it will be such a relief not to be
obliged to wind our watches.
“Mother!” said Sister, coming up back of me and peeping under the
white umbrella which Little Blue Ribbons was holding resolutely over my
head while I sketched; “Mother! what is it you’re drawing?”
“Do you need to ask? Can’t you see it’s the sun-dial?”
“Oh! I thought it was the boy out there in the rain.”

IV.
What can the señor do without his best umbrella? Will he take the black
umbrella of his wife’s aunt? No, he will not take the black umbrella of his
wife’s aunt, dear Mr. Otto, he has taken the umbrella of his wife’s sister, we
will say, to adhere to tradition; but, to tell the truth, I could never say whose
umbrella the señor borrowed, but when he appeared he was really so
beaming under the dark covering over him, that I quite forgot to ask him
whose umbrella it was.
Ah! what would the señor think if he should ever read these words?
Would he forswear the friendship? We should sincerely beg forgiveness, for
we would sooner never see the walls of Domingo again than to lose the
señor’s good-will.
Along the Ozama
Santo Domingo

The excursion up the Ozama was a world of delight from beginning to


end. The Ozama is one of God’s most perfect little rivers, deep and rather
narrow, winding through an enchanting country. The shore is outlined for
miles by never-ending mangroves, and on the higher upper banks are the
breadfruit, and palms, and a world of unknown trees and fruits. Had there
been no palms, no breadfruit or mangroves, it would have been enough joy
to me to know that up this self-same river in centuries long since dead, there
had swept the doughty keels of Columbus’s crazy little ships. But the
Spanish Student was not so easily satisfied; he wanted to know things; how
much mahogany and ebony and lignum vitæ was gotten from the outlaying
country, and what sort of dyewoods they exported. The señor gave much
valuable information, but not much more than the natives themselves, who
came gliding down the stream in dugouts, having in tow one or two or three
mahogany logs. Who says that all the true Santo Domingo mahogany was
cut generations ago? There was a constant and silent passing of these dark
craft, for the most part with but a single occupant. Sometimes a woman in
the bow, half-buried by a cargo of plantains, bending over a pot of some
sort, would be cooking on an improvised camp-fire built on earth above the
plantains; and thus busy—one at the fire, the other at the paddle—she and
her black mate would slip along out of sight under the dark mysterious
shadows of the mangroves, closely hugging the shore.
Not far from the city, the señor pointed to a mighty tree, one of the most
gigantic of the tropics, a ceiba, to which it is said Columbus made fast his
ships. There was no reason to doubt the statement, and, besides, it is so
much pleasanter to believe such natural things than to be for ever doubting.
And why should not Columbus have made his ships thus fast? The ceiba
looked a thousand years old. Who knows but that it is even older?
A little way down the stream and closer to the city, there was a spring of
sweet cool water, and above it a stately canopy of stone, built by
Bartholomew Columbus,—Christopher’s brother,—and called “The
Fountain of Columbus.”
Oh, such a day, under the rocking, tumbling clouds, ever moving, ever
changing, moulding, blending from black to gray and billowy white, under
fitful showers and sudden baths of sunlight! It was a dream day of sleeping
bells and timeless dials and ruined towers and enchanted palaces, with the
bones of poor old Columbus beating time to the hopes of the ambitious San
Dominicans of to-day.
Evening came, and we were at dinner on the boat with our delightful
friend from the shore, drinking to the prosperity of the Dominican Republic,
and to the hope that Señor P—— A—— might live to be President of his
beloved country. But, alas, how many Presidents they have to have in these
Spanish “republics” to round out the tally with Destiny!
It seemed to me that, for my part, if all Spaniards were as gracious, as
hospitable and genuine as our new-found friend, there would never have
been a Spanish-American War.
And so next day we sailed away, leaving the City of the Holy Sunday
wrapped in peace and good-will; but who can tell the day or hour when the
land may again be devastated by revolution?
CHAPTER IV.

SAN JUAN, PUERTO RICO

I.

Looking to Sea from San Juan


Puerto Rico
Copyright, 1901, by Detroit Photographic Co.

W E were creeping in toward the entrance of the harbour of San Juan,


Puerto Rico, waiting for the pilot, who had sighted us afar off. It was
when almost at a standstill that our brown-skinned pilot in his open
lug-sail boat came alongside and sprang for our rope ladder with the nimble
agility of his prehistoric progenitors. He left two small boys, one at the tiller
aft and one in the bow of the boat hanging on to a line dropped them from
about midships of our steamer. The pilot continued shouting at the boys as
he disappeared over our heads to where the captain stood waiting on the
bridge; but things did not seem to go well with the boys below, for instead
of at once assuming command of our ship the pilot again turned his
attention to the boys. He now followed up his first harangue by a
supplement in very angry tones, evidently out of patience with the poor
little fellows, who, much excited, could not seem to keep their boat from
sheering at a dangerous angle, with her bow against the side of our ship. A
quick flash of resentment toward that dusky pilot spread from one to the
other of us as we saw how panic-stricken the boys were, and how as our
ship suddenly put on a bigger head of steam the little boat alongside had
become unmanageable and was in imminent danger of being sucked under
our side. To prove that he was powerless to prevent disaster, after incessant
yells from his father, the lad in the stern-sheets of the boat jumped to his
feet and flung out with tragic despair his two hands, in each of which he
held up the fragments of a broken tiller. Then in all the languages of our
ship the boys are howled at to let go. Already their narrow boat is beginning
to careen dangerously against the side of our moving steamer. Not a
moment too soon they let go the rope, and their excited, high-pitched voices
sound strangely out of place as they rapidly drift astern of us in the open
sea. The pilot had evidently assured his boys that he would look after them,
for within a few rods of the harbour entrance a loitering sail is hailed. To
our tremendous relief we follow the rescuer until we see that a tow is in
progress, and then we feel better.
As we approach the harbour, and at the entrance dodge into a channel
between yellow reefs plainly visible through the clear water, it is no small
thing to see our dear Stars and Stripes peacefully waving over that relic of
mediæval Spain, the venerable Morro of San Juan on the bold headlands to
our left; its wide-spreading fortifications, gray with centuries and fast going
to decay, running in walls and terraces far above the sea. We throw our
whole soul into the soft folds of that flag with a deep sense of joy. There are
among our company some with whom as loyal Americans we cannot but
feel restraint, owing partly to the whisperings afloat that the aliens are
envoys from his Majesty the Emperor of Germany, bent on a mission not
altogether that of pleasure. However that may be, we are all the more
moved to enthusiasm over our flag when we are conscious of the lack of
that sentiment among the Germans. So when we are near enough to the fort
to hear the wild cheers of welcome issuing from every parapet and tower of
that old pile, we know no hounds and answer the welcome as you would
have done had you been there. Spontaneously “The Star Spangled Banner,”
started by the boys on the fort, finds a hearty echo from our ship, and my
eyes are blurred so that the restless, shouting, singing boys on shore look
dim and indistinct. Yes, we are coming home. Uncle Sam owns Puerto Rico,
and I am happy to feel that here in the West Indies he has asserted his rank
among the nations of the world, and intends to make this colonial home a
sweet clean place for all of his children who wander upon Southern seas.
Some day this fair harbour will be filled with ships flying the Stars and
Stripes, and again our merchant vessels will be doing their rightful share of
the West Indian commerce.
The way in which I found my love for those soldier boys expanding was
really wonderful. The sight of those old blue flannel shirts, those faded
Khaki breeches, those tossing felt hats aroused within me in this strange
tropical island unexpected waves of patriotism. There sprung at once a
dangerous leak in my affections, and had it not been for the quiet pressure
upon my shoulder of a strong hand I so well knew, who can tell what might
have happened? Even so, there was not a boy upon the island but I could
have mothered with my whole heart, and I could not, however persistently
that hand still lingered, quite stifle the upheaval of that undying mother
instinct.
Although aware that Uncle Sam was fully alive to the great dower that
this island alliance would bring him, I must still believe that his choice was
not a little influenced by the actual charms of Puerto Rico herself: that,
however much he, a man of some years, might appear indifferent to the
allurements of lovely women, he is still like the rest of his sex chivalrously
bent upon fresh conquests. In this case let us rejoice that he has been so
fortunate, and that so pretty a face has brought so much of real worth.
Although, womanlike, acknowledging a deeper interest in our troops
than in anything else, I could not be indifferent to the city of San Juan as we
slipped past the reef at the entrance into the wide expanse of harbour and
dropped anchor opposite the beautiful landing quay. El Puerto Rico del San
Juan Bautista (The Rich Port of St. John the Baptist), as the Spaniards
centuries before had christened her, opened before us like a bespangled fan,
and threw from her glittering white walls the swaying efflorescence of
stately palms. From the ancient fort on the headland to the Casa Blanca and
the city beyond, it was a progression of delicious sights and sounds.
II.
Has it ever impressed you how rarely nature appeals to one’s sense of
humour? She brings us infinite delights, but seldom cultivates in us our
faculty of laughing. But down here off Puerto Rico, she for once leaves her
beaten track of sobriety and indulges in the most extravagant caprices. How
she ever thought out such a ridiculous line of hills none but Father Time
could tell you; here her centuries of bottled-up giggles have burst forth, and
she has made herself the most outlandish head-gear she could contrive, and
here she stands, caught in the act of being silly. From this distance I should
say the hills are barren, save for now and then a palm, which, dotted
irregularly over the epidemic of peaks, gives the hills the forlorn look of a
mole on an old woman’s cheek. There is every size of these jagged, saw-
tooth peaklets jumping up in the air like so many scarecrows, and when our
ship swings to her anchor and leaves us broadside to Puerto Rico’s shore,
the little girls and I enter into the joke and laughingly wonder how it ever
happened.
Then to match the distant landscape out came the Puerto Rican shore
boats with ridiculous little open hen-coop cabins aft, much like the funny
“summer cabins” affected by some New Jersey catboats—only more so.
There were no end of fine modern launches of all sorts darting about us,
some of them waiting for passengers, and others from our ships in the
harbour bringing officers and ladies aboard, but Daddy would have none of
them. He and the little girls are already under a hen-coop in one of the
miserable little boats and nothing will do but I must go too. I protest, but to
no avail. The stiff shore breeze makes prompt decision necessary, and I
creep down under the coop an unwilling passenger; I would so much rather
have been in one of the puffy boats. So off we go heeling well to the breeze
as our funny, high-slung lateen sail drives us shoreward at a great rate.
We were not alone under the hen-coop, for we had some Puerto Rican
musicians with us, and my qualms at the flying boat are actually forgotten
in the strange but fascinating music of those natives. They carried not only
the universal guitar of the usual form, but also a funny little guitar not a
quarter as big as the ordinary sort, and a curious round gourd with shot or
pebbles inside, which, attached to a handle, they used as a rattle, and other
gourds some eighteen inches long, corrugated with many deep scratches,
upon which they accented the strong beat of the measure by scraping with a
bit of wire in a most dexterous manner. I can well imagine the contempt of
some of our European musicians for such music, but as for myself, although
trained in the most conservative of foreign schools, I could but
acknowledge the deep influence of these untutored artists, and yielded
myself in fascination to the weird rhythm of their music. Music to these
peoples is not a dreary taskmaster, as it is to many of their Northern
brothers; it is as necessary to them as is the outpouring sunlight, and they
use it with a freedom and comradeship and love which is unknown to us.
My senses are suffused with strange emotions of pleasure as I listen
dreamily to the lullings of the water, percolated through and through by the
cadences of low voices and the rhythmic repetition of single notes. I was
unreal to myself even after Captain B—— and his wife, friends whom we
half-hoped to meet in San Juan, had grasped our hands and led us to an
army coach near by.

III.
Instead of being the dumping-ground for all the garbage of the city and
the location for unsightly warehouses, the quay at San Juan is a perfect
delight. I happened to-day to turn to a precious volume of Washington
Irving’s “Life of Columbus.” While reading along I came across a letter in
which the valiant discoverer endeavours to bring to his king some
conception of the beauty of his newly found lands; saying that he fears his
Majesty may have reason to doubt the veracity of his statements, for each
new island surpasses in beauty the one before; in fact that one could live
there for ever. Time cannot efface the noble bearing of Puerto Rico, and
although far, far removed from the picture which met the eyes of her early
discoverers, she is to-day not only from the standpoint of the picturesque,
but from the practical aspect of cleanliness and order, a place to which
every American may turn with pride.
Boat Landing and Marine Barracks, San Juan
Puerto Rico
Copyright, 1901, by Detroit Photographic Co.

To find upon landing a noble water-front finely paved, relieved by grassy


quadrangles in which choice varieties of palms are set with the unfailing
intuition of the true nature lover, places one at once en rapport with the best
things of life. Why, why are we of the North so blind to the soul’s necessity
for beauty? Why are we so dumbly indifferent to that craving? If we but
looked deeply enough into the psychological influence of beauty, we would
be forced to recognise man’s necessity for its expression in public places.
There is no city among the Spanish-speaking peoples but has its restfully
attractive plaza, varying in beauty as the wealth of the community permits
—a playground and a club-house and a concert-hall in one for all the
people. And when my mind reverts in unwilling retrospection to the
innumerable hideous and barren cities large and small of our United States,
it seems to me that we are hopelessly lost in the fog of the common-place.
If we Americans were a poor people, there might be palliating
circumstances, but we are not poor, we have more wealth than any people
on earth, and surely a republic should give its equal citizens all the beauty
and pleasure possible. We are merely blind, that is all. Pray God that our
eyes may be opened and that right soon!
In these islands the plaza, where the people live largely in the open air, is
the synonym for all that is congenial to the eye and soothing to the ear, and
this explains much of the enthusiasm which we starved Northerners express
when once within the satisfying influences of such surroundings.
Captain B—— and his wife are graciously willing to wait our pleasure,
while we linger idly content, but we must not trespass too long upon their
indulgence; so we enter the coach and rumble up the steep narrow streets
after four lustrous army mules. Our driver, a native Puerto Rican, speaks to
the mules in English, and ready with the explanation before I could form
the question, Captain B—— says: “Yes, the boys use English, because their
mules were brought here from the States, and of course they wouldn’t
understand if the boys spoke Spanish to them.” Stopping for the passage of
an army freight wagon, it seemed very comical to me to hear those Puerto
Rican lads “gee-hawing” to the sleek American mules.
If the politics of our American cities could be as well administered as
those of San Juan appear to be from the cleanliness and order of her streets
we would indeed have cause to rejoice. The streets of San Juan were so
clean that even the trailer of skirts might for once be forgiven her lack of
common decency. She could have walked the full length of San Juan and
not gathered up as much filth as she would in one block of one of our
Northern sidewalks. Such was the cleanliness of the place that again and
again we exclaim over the fine condition of the city; and Captain B——
bore out our impression that Uncle Sam had done his house-cleaning most
effectively, and was now trying to maintain that condition by educating a
force of native police,—“spigitys,” our boys call them.
As we were going through the Plaza we saw a great crowd on the far
side, gathered about a regular American “trolley-car,” and wondering at
their enthusiastic demonstrations, we were told that this was the first trip of
the first electric car in Puerto Rico—a great step toward becoming
Americanised.

IV.
We were in the Captain’s hands, and although Sister and Daddy were
decorously unquestioning as to where we were going and what we were to
do when we got there, Little Blue Ribbons and I couldn’t refrain from
asking, when we found ourselves clattering out of San Juan to the tattoo of
the hard little hoofs, if the Captain intended to drive us to Ponce? “Oh,
hardly, this evening,” he laughingly replied. “I thought we would merely
take a spin out a way on the military road to give you a glimpse of the
country. The madam has planned a Puerto Rican dinner for you at the
Colonial, and afterward there is to be a concert on the Plaza.” “Simply
fine,” I said, “I do so enjoy trying the native bills of fare” (but alas, for their
after effects!).

The First Trolley Car in San Juan


Puerto Rico

The military road, a beautiful macadamised highway, swept through a


country whose surface was richly covered with broad pasture lands where
many cattle were grazing. The plains were fairly peppered with palm-trees,
which, owing to their long trunks and pluming tops, interfered but little
with the pasture beneath. The military road is fringed by these noble trees,
at least as far as we go, and although now to us a necessary feature in the
West Indian landscape, I never weary of their aristocratic grace. We must
have gone some miles when the madam suggested our return. A crack of the
whip, a vociferous shouting to the mules, and the coach faces right about
with military precision for San Juan. With many a bewildering twist and
turn through the upper town, we reach the Morro headland, and are glad
enough to leave the coach and throw ourselves into the deep grass, where
we sit a long time looking out to sea.
Those of you who have been there know; those of you who have not,
never can know the loveliness of that far-spreading vision. No, not if all the
poets joined in one grand panegyric, you would never know what it all
meant. You would need to feel the dull booming of the sea against the cliffs
and hear the cool rattle of the palms crooning over the children in the Casa
Blanca; you must run your hands through the stiff deep grass down to the
earth which makes so sweet and so warm a bed; you must throw back your
face to the uplifting Northeast Trade; then you will know what it means to
sink down upon the green carpet of San Juan and look out to sea.
A veil dropped over the still water; the sea and sky melted into one
substance; then we arouse sufficiently to realise that the madam is waiting.
By this time San Juan had made ready for the night; we could see the fitful
flicker of her electric lights down near the barracks, and here and there the
dull red stare of an olden time street-lamp swinging midway between the
dark lanes which intersect the upper town like long tentacles.

The Military Road Across Puerto Rico


Near San Juan
Copyright, 1901, by Detroit Photographic Co.

We ran down along the sea-wall, under the lattice of the stately Casa
Blanca, and came into the city; turning abruptly to the left we were about to
follow the Captain up the steep street, when I was stopped suddenly with
my whole soul ablaze with wonder, for there on the top of the hill, as if on
the very stones themselves, there rolled a great yellowish-green moon, and
about it there fell a heaven splashed with emerald and gold. There were
green and yellow and strange hues of blue all blending into a splendour
which dazzled the senses and made one feel dumb. I am so thankful that we
saw the moon before dinner. I couldn’t have looked in the face of a green
moon afterward, no, I could never have done it.
I beg of you to be as considerate of me as possible in your judgment. I
do not mean to be ungrateful to our dear hosts, or unkind or disagreeable;
but after that dinner, planned for us with so much care and pride, all I could
say was, “O Lord, have mercy upon us—miserable offenders!” We had
things to eat I had never dreamed of, and may I be spared a recurrence of
them in my future dreams! There were:
Tomatoes and peppers.
Pork chops, and peppers.
Codfish, vegetables and peppers.
Chicken and peas and more peppers and some black coffee and cheese,
and the sweetest sweets I ever tasted, with a final dessert of beans with a
sugar sauce. After dinner madam had chairs arranged on the balcony over
the Plaza. She led the way, and said the concert would be delightful in the
moonlight. But as the pepper and the various concoctions of grease and
greens and sugar and beans began to make themselves felt, I turned my
chair around, saying that I never could look at the moon any length of time,
especially a green moon. Then Sister gave me a despairing look and turned
her chair around too; gave my hand a hard squeeze, and leaning over, said:
“Mother, it’s the peppers and sweet things; do you think Daddy could get
me some Jamaica ginger?” A whispered consultation is held, after which the
Captain and Daddy disappear, and then something warm and comforting is
fixed up for Sister and me, and we decide that after all we will turn our
chairs around to face the moon, but alas, the inconstant creature had slipped
on her black hood and was scurrying off like a little fat nun. She was no
more to be seen that night.
But her displeasure does not affect the humour of San Juan, for by this
time the Plaza is filled with people making “el gran paseo” around and
around the square in true Spanish fashion.
Meantime the Plaza is being filled with chairs—rocking-chairs—which
seem to spring up out of nothing. I never saw or expect to see so many
rocking-chairs in any one place. Here the “Four Hundred” sit, having paid a
small fee for the use of the chairs, and here they rock back and forth and
back and forth in endless waves until the music begins. Some rock with the
elegant ease of the portly señora and others with the sprightly jerk of the
laughing niñita, and as seen from the veranda of the Colonial, the eyes ache
as they involuntarily follow the moving crowds circling countless times
around the improvised barricade of oscillating chairs. But the music begins,
the people are suddenly still, and out over the luminous night, still eloquent
of the retreating moon, there fall the first notes. I know that it is rank heresy
in me to acknowledge to any race but the Germans a preëminence in
musical intuition; but I shall do so in spite of all the traditions of my youth.
I believe that if the Spanish-American races could be given the skill and the
knowledge to formulate their musical ideas to such an extent as has come to
the painstaking Germans by generations of grinding, we would have greater
music—and certainly more human music—than the world has ever heard.
The Puerto Rican, as well as the Mexican, the Cuban, the Dominican, is the
natural musician; he feels to his finger-tips every vibration of sound he
utters, and he makes you feel what he does. His music is akin to that of the
wild sea-bird, it is brother to the moaning of the winds, to the wan song of
the dusky maidens in the dance—to dream sounds in cocoanut and palm-
tree groves; it is life, moving, quickening, pulsating life their music speaks,
and without life, what is the stuff we call music?
“Thank you, thank you, you have given us an evening we shall never
forget. Shall we not see you in the morning? Buenas noches.”

V.
It was high noon as Little Blue Ribbons and I left the empty Plaza and
started out with grim determination to do our duty. The streets were silent as
the sun crept over our heads and sent its burning, perpendicular rays
through the white umbrella. But that was of no consequence. We two had
made up our minds to accomplish a certain purpose, and when we make up
our minds neither man nor weather can prevail against us. We had been idle
long enough. Time and time again we had drifted to the time-ripened
Morro. Days had gone by and we lacked the energy to begrudge their
inconsequential passing, but now a time of reckoning had come. We would
have no more such idleness. Little Blue Ribbons and I had awakened on
this particular day to a realisation of our unperformed duty, and although
detained through one pretext and another all the morning, by noon we
forswore further procrastination and hurriedly left the Plaza before our good
intentions could again be lulled by inaction.

Inland Commerce
Puerto Rico
Copyright, 1901, by Detroit Photographic Co.

It was to the Square of Ponce de Leon we were going; and although not
sure of its exact location, we remembered a fine old church near by, and that
was our landmark.
It is strange indeed what a web of dreams the past weaves about its
heroes, however recent their careers; but when the hand of time leads us
back to the remote events of centuries gone by, we are hopelessly
bewildered by the discordant wrangling between the real and the
improbable.
Although the early companion of Christopher Columbus, the discoverer
of Florida and the intrepid voyager on many seas, the conqueror and the
first governor of Puerto Rico, and later the powerful and hated rival of
Columbus’s son, Ponce de Leon’s one unrealised hope, his tireless search
for the fountain whose waters were to contain the elixir of life, has so over-
shadowed his actual achievements by the glamour of the legendary, that his
very name has become the synonym for the stuff of which dreams are made.
Standing thus as the embodiment of the unattainable, the knight errant of
roseate hopes and undying aspirations, he has ever been, in spite of the
irascible humour given him by history, a figure from whom none could
wrest the talisman of romance.
Where are his contemporaries, where are those greater discoverers, abler
rulers, better men who thronged these alluring waters during the two
generations of Ponce de Leon’s eventful life? Dead, even in name, many of
them, or else safely embalmed in the musty pages of some old history
seldom read. But in him there was the spirit of the poet and the mystic,
which ever has and ever will appeal to the imagination of mankind and
through imagination attains immortality.
Thus it suggested much to us to find his statue in San Juan and to have
heard some one assert with an air of authority that his bones rested in the
old church hard by; all of which bore incontrovertible testimony to the fact
of his having once been an actual living personality. So we two decide
without saying a word to any one that we will make a pilgrimage to that
church of the uneasy shades and prove for ourselves Ponce de Leon’s
identity with fact.
With a feeling of affinity for the doughty old cavalier, and with half a
sigh that I can never again lift my feet with the light-hearted grace of the
little maid at my side, we wander on through the deserted streets until we
come to the square of Ponce de Leon. It looked as it had before, only much
whiter, much brighter, and oh, so silent! The church stood passively asleep;
there were only the still hot rays reflected into our faces from the sun-baked
pavement. The same, and yet not the same, was the empty square, for as we
made nearer approach we found that the pedestal upon which before the
figure of Ponce de Leon had stood with lofty bearing and haughty mien was
now but a bare block of stone glaringly white in the noonday silence with
naught but the inscription left.
The figure was gone! “Can it be that we have been dreaming, that it was
never there?” I ask, in consternation. “No, Mother, surely not, I remember
perfectly well a statue was standing there as we drove through only last
evening.” With a startled tremor I wish the place were not so deserted, I
wish some one would come, I dislike being so alone, and I wish that we had
Daddy with us. But pulling ourselves together with a frightened glance over
our shoulders, we pass the abandoned pedestal and go toward the church,
unquestioningly sure of safe sanctuary within its open door. To our
amazement we find it barred and locked. We try a side entrance; that too is
mysteriously fast; but hearing a faint sound, as of retreating feet within, we
venture a timid knock on the door. But our rappings bring no response save
a hollow echo and a momentary cessation of the footsteps.
Still hesitating as to our next move, we stand there in the white glare,
while a sensation of strange unreality creeps over us. Hesitating, but still
unwilling to relinquish the pilgrimage without further effort, we spy an
ancient iron-bound gate in the high stone wall adjoining the cathedral. We
try its rusty latch and find it unlocked. We cautiously push it open. It turns
heavily on great creaking hinges stiff from long desuetude, and swings to
after us as with an ominous sigh.
We find ourselves in the secluded corridors of an ancient cloister. The
sun still lingers on a patch of green courtyard dropped in the midst of the
shadows, and up from the luminous verdure a cool fountain plays its restful
measure. An ancient sun-dial speaks of the deathless tread of time, and in
the deeper shade of a dark recess, on tables of venerable age, huge volumes
lay, on whose yellow pages were strewn adown the wide-spread lines of the
quaint Gregorian staff, the great square notes of an ancient Latin chant.
Then,—
“On a sudden, through the glistening
Leaves around, a little stirred,
Came a sound, a sense of music which was rather felt than heard.
Softly, finely it inwound me;
From the world it shut me in,—
Like a fountain falling round me—”

My hand is held close and with wide eyes Little Blue Ribbons asks if she
may drink at the fountain. Half-refusing, half-assenting, we are about to
draw near, when from out an opening door, whence seemed to come the
music, there appeared a figure bent in contemplation and wrapped in the
shadows of the past. It was so like the statue on the square without that the
one at my side gasps, “It is he, Mother, what shall we do?” and shrinking
spellbound, I hold the dear little hand, glad to feel the human warmth of its
pressure. With dread and yet with fascination I watch the lone, sad, weary
figure, as it were the phantom of old age eternally unreconciled to the flight
of youth. I watch while it moves eagerly toward the fountain to lean
forward and drink deep, deep, with an insatiable thirst; and then with a
hopeless sigh it paces back and forth among the shadows.

A Ranch Near San Juan


Puerto Rico
A bell clangs out the hour of one, and the great wooden gate swings open
of itself, while we two, much affrighted, slip unnoticed behind the columns
of the corridor into “the twilight gloom of a deep embrasured window”
which for long years had been sealed from the light by the gray masonry of
the ancient church.
Even as we look the silent figure has vanished, and we are left there with
only the sound of the plaintive, ever murmuring fountain.
Awed and silent, we creep from our hiding-place and drag open the
unwilling gate and once again we are out in the dazzling sunlight.
There—wonderful to relate—on its pedestal was the statue as it stood the
day before, with outstretched hand and far-away look, scanning the distant
horizon where to his ever disappointed eyes was just lifting the palm-
fringed shore of that mythical island of Bimini, where at last flowed the
long-sought fountain of youth.
Lest the unhappy shade again returning should seek sudden vengeance
for our bold espionage, we took our flight toward the Plaza, nor stopped to
breathe until again we found refuge in the crowded shops.
CHAPTER V.

CHARLOTTE AMALIE. ST. THOMAS

I.

A FTER the long stretches of ocean, you from the North will find that
there is something positively cosy about these dear islands. You tuck
your head under your wing with the parrots at night, off one island,
and, the next thing you know, it’s morning, the sweet land-breeze steals in
through the port-hole, and you’re up with the monkeys off another island—
perhaps more enchanting than the last. Why, it seems not half the trouble
going from port to port that it is to make fashionable calls in the great city,
and such a lot more fun.
But speaking of parrots and monkeys: the only ones we have seen thus
far were some very solemn little creatures which have been brought to the
ship for sale,—poor captives, chained and unnaturally pious, sitting
alongside their black captors.
We have not heard a single bird-note since leaving the North. Is it
possible that there are no song-birds here, and in fact no birds of plumage
left about the settlements? We fully expected the latter, but not a glimpse
have we had of them,—no, not even in the forest along the Ozama, did we
distinguish a single bird-note. Can it be that the plume-hunters for our
Northern milliners have ranged through all these sunny islands? Ah, my
friends of the feather toques and the winged head-gear, what have we to
answer for? It all seems so empty without the birds where trees and flowers
grow so gladly; just as if Nature’s feast were spread to empty chairs. After
all, how fondly we do love that particular expression of creation with which
we are long familiar! My heart reaches out in homesick yearning for the
notes of our dear Northern songsters. How brutal are the details of the
“march of civilisation!”
From San Juan, Puerto Rico, to St. Thomas it was only a night’s journey,
and I am sure, had we been so disposed, we might have touched some other
islands equally lovely on the way. But there must be some time for rest,—
even though Little Blue Ribbons said she did not want to sleep (she knew
she couldn’t), and Sister thought it a great waste of valuable experience not
to make all the ports there were. Nevertheless, when morning came and the
sun was wide awake, I had no little trouble in arousing the children.
And now it came to pass that all those threatenings and fitful tears and
dire forebodings of the day before were simply whims and weather jokes.
The sea fell into a gentle calm, and on St. Thomas there never shone a
brighter sun or blew a sweeter breeze; and we realised that at last we were
under the lee of that smiling windbreak of the Caribbean—“The Windward
Islands.” Getting our anchor early, we moved from our first stopping-place,
well out in the harbour, over to the wharves; where the huge piles of coal
rose up before the port-hole, with other ranges of piles, like mimic
mountains, farther on, while we were so close to the dock that I could see
the gangway being lowered, as I bent over the sleepy little girls.

The Harbour
Charlotte Amalie, St. Thomas

“Look, children!” I said,—“look, wake up, you’re losing so much!” And


they rub their pretty eyes and want to know what’s the matter.
“Here we are, dears, at St. Thomas, the coaling-station. Daddy is waiting
for us. I’ll go up on deck. Send word by Rudolph if you want me to help
with the ribbons.”
So I hurried up the after companion stairs. Close to our side were the
mammoth piles of coal, from which we were to make requisition; off about
a mile to the other side of the great amphitheatre lay Charlotte Amalie (the
chief city of the Danish Islands), making for herself as beautiful a picture as
one could wish. We were in a superb harbour, with high, dome-shaped hills
embracing us on either side, and the little city of Charlotte Amalie to the
right of us on the beautiful slopes above, like a white lady reaching out her
jewelled hands in gracious welcome. Whatever tales of buccaneer and
pirate, of scuttled galleons, of buried treasure, of maidens fair, of romance, I
had ever heard, came hurrying back to me in that delicious spot; and when
the Castles of Bluebeard, and that erstwhile king of pirates, Blackboard,
came into view, it seemed truly as if we ought to fly at our main-truck the
black flag with the skull and cross-bones, and run out the cold bronze nose
of a “long-tom” over our bulwarks, just to add the finishing touch.
The little girls and I were simply determined to let romance run riot in
Charlotte Amalie. We would eat pomegranates and wear flowers in our hair;
we would dream dreams on Bluebeard’s turret, and win into smiles his
villainous, wrinkled, old ghostship. But, firm as was our purpose, it
required no small effort to keep it uppermost in our minds. We thought
Daddy would certainly be dragged into the water before he had engaged his
shore boat. He was howled at, pulled at by the sleeves, jerked at by the coat,
by great roaring blacks, fairly gnashing their teeth in impotent rage at
Daddy’s indecision. But who could decide in such a mob? We were
beckoned, at last, to come along, and picking our way down the ladder,
plumped ourselves into “Champagne Charlie’s” boat, leaving “Uncle Sam,”
“Honest William,” “Captain Jinks,” and a score of others screaming a
medley of imprecations and their own praises in a mad scramble for the
next victim.
We were not only beset by those in the boats, but also by a swarm of
semi-amphibious imps,—not little imps by any means, but huge, muscular,
bronze Tritons, who pursued, with wonderful rapidity, “Champagne
Charlie’s” catch, and clung to the gunwale of our boat, and dove underneath
and about us, wholly indifferent to our terror at the thought of being
capsized. They howled, they swore with Southern abandon because we
would not throw them pennies to dive for; and away off lay the little White
Lady—the beautiful Charlotte Amalie. What a naughty lot of children she
had! Daddy told “Charlie” that if he would not hurry us out of that mob,
he’d not get a penny for his trouble, and Daddy used forcible English, too;
for, strange to say, English is the common as well as the official language of
the Danish West Indies. But I must not mislead you. It’s not your English or
my English they use; it’s a funny kind of jargon; a baby talk disguised by
Scandinavian intonations and besmirched by generations of African
savagery. Sometimes you think you understand it, and then you think you
don’t, and again you wish you hadn’t—so there you are.
Well, “Charlie” is at last aroused and a few good strokes of his oars free
us from the vermin and bring us into less troubled waters. On the way
across the land-locked harbour we passed a Danish man-of-war, a Russian
frigate, a Venezuelan cruiser, a little schooner-rigged sailing “packet,”
which carries the mail to other islands, and a number of powerfully built
trading schooners; still nearer shore, there was a fine floating dry dock,
where a very shapely little schooner—evidently once a yacht—was out of
water being repaired.

II.
Hillside Homes
Charlotte Amalie, St. Thomas

As we stepped on land and walked up under the shade of mahogany and


mango trees, while the boatman’s fees were being struggled with, it seemed
to me that I had never walked in so clean a street, or stood in such delicious
shade. Oh, it was so clean and cool and beautiful! The macadamised streets
were sprinkled and moist, the houses were all white and green, hugged
close by high-walled gardens overflowing with flowering vines,—in
particular that marvellous Bougainvillia, which flourishes in such
triumphant splendour over these tropic walls; and everywhere the odours
were sweet. The sky, as it glistened through the heavy, glossy mangoes, was
as blue as blue can be, and the women carriers of water moved with rapid,
noiseless tread, bearing their burdens upon their turbaned heads, and the
little children offered us flowers. I find, as I write, that my mind constantly
reverts to the cleanliness of the place. First, I said: “Oh, how charming!”
and then, “Oh, how clean!” but, before I proceed further, you should be told
that, the widely followed example of Spain—mother of the picturesque—is
not responsible for this delightful condition of things, for in the Spanish-
speaking islands, alas! it is otherwise!
Just here I must make a confession. I couldn’t tell you of the petty
blemishes on the time-furrowed brow of wonderful old Santo Domingo—
no, I could not, for there were those tears that for centuries had worn their
cankering way across the face of the weary old Mother Church,—and then
the long-suffering bell, and the tired, sad-faced sun-dial! No, I could not tell
you then; and now that the memory of those tears comes to me again, I
hardly feel it in me to confess to you after all. No, I never can! Those half-
forgiven regrets could be told only to the dispassionate bells of the City of
the Holy Sunday; you shall never hear them.
Yes, Charlotte Amalie’s face was clean. She wore a fresh pinafore and a
green frock, and her bonnet was pink and starry white; and she was very
prim and quiet, was the Lady Charlotte, despite her merry, laughing eyes.
But the little lady has a funny lot of children. She doesn’t mind, though—
not she. She folds her hands, and shakes her pink and white bonnet, and
makes no apology. A funny lot of children she has indeed: blond
pickaninnies and black babies,—black whites with kinky hair and white
blacks with straight hair, all higgledy-piggledy, and they all speak a blond
pickaninny’s language. Charlotte Amalie herself, when in state, speaks real
English, and some of her officials Danish and French, as well. Her little
daily paper, which came to us wet from the press,—Lightbourn’s Mail
Notes,—was printed in English; so you see her ladyship knows the real
world-language when she sees it, even if she is a foster-child of Denmark
and burdened with the everlasting curse of Ham.

In Charlotte Amalie
St. Thomas

III.
While some of the party were writing postal cards and letters in a cool,
flowery retreat, reached by devious shady passages and looking out into an
open court, known as a post-office, I strolled up the quiet street to the first
turning, where the cross road came to an abrupt, but very beautiful end in a
little white chapel, sheltered by waving palms. There seemed to be but one
main street, which followed the shore awhile and then went loitering off up
the hill in a most indifferent manner.
The houses, with one story in the rear and two in the front, were built on
the hillside, so that the chapel before me—well up on the slope—was
approached by a long flight of stone steps. Snow-white columns upheld the
simple portico, and the royal palms rose higher and higher from one terrace
to another, their regular trunks like stately shafts of stone, until their warm
plumes met over the golden cross. The picture, with chapel and palms and
terraces and flowers and delicately wroughtiron gateway, was so compact,
that it seemed as if some one just a little bigger than myself might tuck the
whole affair right into a pocket for a keepsake.
Turning slowly about to look for the children, I glanced through the half-
open blinds of a house on the corner, and there met a pair of very engaging
eyes, which besought me in the universal language, to come in and see what
there was for sale. The eyes belonged not to a maiden, but to a tiny, stoop-
shouldered Spanish-Danish-English woman, who fluttered about in great
excitement at the prospect of a sale. Strangers do not drop from the sky
every day in these remoter of the West Indies. I bought a piece of
needlework, and my change, in St. Thomas silver and Danish copper, was
brought me by a regal old negress, in a voluminous red calico gown,
standing out like the “stu’nsails” of a full-rigged ship, flying as her proper
colours aloft, a brilliant green and yellow bandanna. My! but she was tall—
six feet, it seemed, and she smiled all over her face with the meaningless
good-nature of her race. What teeth she had left were glistening white. By
the way, why is it that on these islands you find so many women, and not
necessarily old women by any means, but girls from fourteen up—both
white and black—with many of their teeth gone? Has the American dentist
yet untrodden fields?
Black Susan salaamed me out, and seeing Daddy and the little girls
ahead of me, I followed the clean—I repeat, clean—narrow street, as it
wound up the well-tilled hillside to “Bluebeard’s Castle.”

IV.
It was a long, hot walk, that climb, in spite of the good breeze and the
white umbrella’s shade, and we stopped a number of times on the way up to
cool ourselves, and, incidentally, to envy the carriage of the brisk and
leathery old women, who came striding past us up the hill, with great water-
cans on their heads and water-jugs in their hands, stolidly indifferent to the
hot sun and the heavy burdens they were carrying. It comes to me now that
I did not see a young negress in the whole town, but this was explained on
our return to the ship.
It was next to impossible to be keen enough to appreciate fully the
remarkable vegetation and flowers and animal life all about us. The flowers
seemed hung at the wrong end, and all the vegetable world strange and
topsy-turvy; even some insects that we saw seemed quite outlandish. For a
long time, as I sat between two rusty old cannon, dangling my feet with
most awful irreverence over Bluebeard’s fortress wall, I kept my eye on an
old bumblebee—a black and yellow pirate that bumbled of the peaceful
present and the strenuous past; but even the every-day bumblebee was twice
as big as he had any right to be, and he had the deep-drawn drone of a
sleepy country parson. Then, just as the bumblebee hummed himself out of
sight into the heart of a deep red hibiscus nodding its heavy head at me
from the top of the wall, out of the mouth of one of Bluebeard’s piratical
cannon there peeped two shining, yellow eyes in a little green body, and
they stared at me, and I stared at them, each most curious about the other,
until the inspection became rather embarrassing, and I rapped on the rusty,
weather-worn old murderer, and away scampered Mr. Eyes, back with the
ghosts and memories—all dying together. A little green lizard, with life for
a wee bit of awhile; an ancient cannon of curious shape, rusting, but
outliving a little longer; a great gray rock underneath, disintegrating piece
by piece, going back again into the universe; and an immortal soul in a
human body; are we all part and parcel of the same cosmic dust?
Twenty cannons dropped into the heavy embrasured masonry of
Bluebeard’s wall looked down with grim irony upon a pious, self-
complacent, twentieth-century gunboat, entering thus unchallenged their
own waters. Whether it was the lizard rustling among the grasses inside the
cannon, or whether it was a reawakened pirate’s ghost, I shall not venture to
assert; but there certainly came to me a whisper which translated itself into
the most disdainful reproach of our much-vaunted humanitarianism. I tried
to explain to this little voice that nowadays we had reduced the killing of
men to a science; that it was less painful to be blown to pieces by dynamite
shells from a torpedo-boat than to be hacked to pieces by a pirate’s cutlass,
therefore, more honourable, and that fighting was still necessary because
diplomacy was too young to be weaned. But from certain mysterious
sounds, very like the chucklings of an old man, I thought best to beat a
retreat. Besides there were Daddy and the little girls waving to me from the
top of the sturdy old watch-tower, so I gathered my umbrella, hat, and
basket, and put to flight the flock of geese which had been examining my
umbrella with long-necked curiosity. They, little caring for the sanctity of
my far-reaching thoughts, went hissing and squawking down the hill in a
most irate humour. I took a long breath, pinched myself to get awake, and
started up the steep tower steps.

Charlotte Amalie from “Blue Beard’s Castle”


St. Thomas

From the top of this tower of “Bluebeard’s Castle” (kept in repair by the
Italian consul, whose residence is here), one could look out across the pretty
town to the rival fastness of old “Blackbeard,” crowning another hill of
surpassing beauty. A road, white and smooth and shaded with palms, clung
caressingly about the white-crested bay, and I longed to follow it. Yonder
another road struggled up a hillside, through sugar-cane and fruit-trees, and
tumbled off somewhere on the other side. I longed to follow that one, too.
Another, white and edged with tamarinds and oranges, wandered off
somewhere else, and I wanted to go there. But the last carriage had clattered
off, and it was too hot to walk “over the hills and far away;” so, after a long
quiet feast of the glory about us, we leisurely made the descent, and were
again among the cannon crowning the ancient parapet. We strolled along
down the steep winding highway, stopping now to trim our hats with
flowers, gathered with much difficulty from behind a prickly hedge, and
then to look with rapture upon the scene below, and again to talk about it
all. The sun beat down upon our heads, but we did not mind that, for the
cooling breeze came up from the sea, sweetly and gently, as if it loved us,
and the mountains and the earth were oh, so richly clad, and the eyes so
content with seeing and the nostrils so glad with the fragrant air!

V.
I wondered then why we Americans should not settle the matter at once
with Denmark. As I understand it, there were negotiations for the purchase
of these islands approved by General Grant, then President, in 1867; but, for
some reason, the proposed treaty with Denmark was not ratified by
Congress, and the little island was forgotten; but since the recent growth of
our navy and the necessity for its constant care of the Caribbean Sea, and
especially now that we seem destined to become sponsors to an Isthmian
canal, the island of St. Thomas comes again to the front as one of the most
desirable possessions the United States could have in these waters. The
harbour of Charlotte Amalie is so protected by mountains and guarded by
bold islands, with deep water inside, and an unimpeded channel from the
sea, that, with sufficient fortification, it could be made absolutely
impregnable, a West Indian Gibraltar, and at the same time a most valuable
and protected station for naval supplies, docks, and the like.
On the Terrace
Charlotte Amalie, St. Thomas

I do not believe in war, battle, or bloodshed, but I do most forcibly


believe in the present necessity for our policy of expansion,—not alone
because of the advantage to ourselves, but as well for the good of the yet
unborn West Indians; and if we can extend our power through diplomacy
and peaceful measures, I should be glad to see “Old Glory” floating over all
the Greater and Lesser Antilles, provided—and this is the terrible if—that
the present mixed and degenerate population could be miraculously
reformed or removed.
In the case of Charlotte Amalie, there seems to be among the educated
middle classes a sincere desire for American supremacy, and, although there
is some opposition—largely sentimental—from leading Danes, the only
important points that have arisen seem to be the question of how much we
are to give, and whether certain influences in Denmark will permit the
confirmation of a treaty for the transfer of the islands to the United States. I
was told that the price suggested was somewhere about $5,000,000. This, I
presume, does not include the rest of the Danish possessions among the
Virgin Islands; but, while we are interested, why not take in the whole
family; St. Thomas, St. John, St. Croix, and the other small islands
adjacent?
Will the Germans try to block our acquisition of this group? The Kaiser’s
subjects talk fair enough, but they unquestionably want St. Thomas—and
Welcome to Our Bookstore - The Ultimate Destination for Book Lovers
Are you passionate about testbank 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!

ebooksecure.com

You might also like