100% found this document useful (2 votes)
40 views

Programming Logic and Design Comprehensive 6th Edition Joyce Farrell instant download

The document provides information about the 'Programming Logic and Design Comprehensive 6th Edition' by Joyce Farrell, including links for purchasing and downloading the ebook. It outlines the contents of the textbook, which covers various programming concepts and techniques. Additionally, it mentions other related titles by the same author and offers insights into the structure and features of the book.

Uploaded by

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

Programming Logic and Design Comprehensive 6th Edition Joyce Farrell instant download

The document provides information about the 'Programming Logic and Design Comprehensive 6th Edition' by Joyce Farrell, including links for purchasing and downloading the ebook. It outlines the contents of the textbook, which covers various programming concepts and techniques. Additionally, it mentions other related titles by the same author and offers insights into the structure and features of the book.

Uploaded by

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

Programming Logic and Design Comprehensive 6th

Edition Joyce Farrell pdf download

https://ebookname.com/product/programming-logic-and-design-
comprehensive-6th-edition-joyce-farrell/

Get Instant Ebook Downloads – Browse at https://ebookname.com


Instant digital products (PDF, ePub, MOBI) available
Download now and explore formats that suit you...

Just Enough Programming Logic and Design 1st Edition


Joyce Farrell

https://ebookname.com/product/just-enough-programming-logic-and-
design-1st-edition-joyce-farrell/

Java Programming 5th Edition Joyce Farrell

https://ebookname.com/product/java-programming-5th-edition-joyce-
farrell/

Object Oriented Programming Using C Fourth Edition


Joyce Farrell

https://ebookname.com/product/object-oriented-programming-using-
c-fourth-edition-joyce-farrell/

Essays on Philosophy and the Classics 1828 1st Edition


John Stuart Mill

https://ebookname.com/product/essays-on-philosophy-and-the-
classics-1828-1st-edition-john-stuart-mill/
The Guide to Managing Postproduction for Film TV and
Digital Distribution 3rd Edition Barbara Clark

https://ebookname.com/product/the-guide-to-managing-
postproduction-for-film-tv-and-digital-distribution-3rd-edition-
barbara-clark/

Friedelind Wagner Richard Wagner s Rebellious


Granddaughter 1st Edition Eva Rieger

https://ebookname.com/product/friedelind-wagner-richard-wagner-s-
rebellious-granddaughter-1st-edition-eva-rieger/

Thai massage the Thai way healing body and mind 2nd
Edition Jan Chaithavuthi

https://ebookname.com/product/thai-massage-the-thai-way-healing-
body-and-mind-2nd-edition-jan-chaithavuthi/

The fine art of success how learning great art can


create great business 1st Edition Reckenrich

https://ebookname.com/product/the-fine-art-of-success-how-
learning-great-art-can-create-great-business-1st-edition-
reckenrich/

Our Parents Ourselves How American Health Care Imperils


Middle Age and Beyond 1st Edition Turiel

https://ebookname.com/product/our-parents-ourselves-how-american-
health-care-imperils-middle-age-and-beyond-1st-edition-turiel/
Convergent Journalism an Introduction Writing and
Producing Across Media 1 edition Edition Stephen Quinn

https://ebookname.com/product/convergent-journalism-an-
introduction-writing-and-producing-across-media-1-edition-
edition-stephen-quinn/
PROGRAMMING LOGIC
AND DESIGN
COMPREHENSIVE
This page intentionally left blank
SIXTH EDITION

PROGRAMMING LOGIC
AND DESIGN
COMPREHENSIVE

J O Y C E FA R R E L L

Australia • Brazil • Japan • Korea • Mexico • Singapore • Spain • United Kingdom • United States
This is an electronic version of the print textbook. Due to electronic rights restrictions, some third party content may
be suppressed. Editorial review has deemed that any suppressed content does not materially affect the overall
learning experience. The publisher reserves the right to remove content from this title at any time if subsequent rights
restrictions require it. For valuable information on pricing, previous editions, changes to current editions, and
alternate formats, please visit www.cengage.com/highered to search by ISBN#, author, title, or keyword for
materials in your areas of interest.
Programming Logic and Design, © 2011 Course Technology, Cengage Learning
Comprehensive, Sixth Edition
ALL RIGHTS RESERVED. No part of this work covered by the copyright
Joyce Farrell
herein may be reproduced, transmitted, stored or used in any form or by
Executive Editor: Marie Lee any means—graphic, electronic, or mechanical, including but not limited
to photocopying, recording, scanning, digitizing, taping, Web distribution,
Acquisitions Editor: Amy Jollymore
information networks, or information storage and retrieval systems, except
Managing Editor: Tricia Coia as permitted under Section 107 or 108 of the 1976 United States Copyright
Developmental Editor: Dan Seiter Act—without the prior written permission of the publisher.
Content Project Manager: Jennifer Feltri
For product information and technology assistance, contact us at
Editorial Assistant: Zina Kresin Cengage Learning Customer & Sales Support, 1-800-354-9706
Marketing Manager: Bryant Chrzan For permission to use material from this text or product,
Art Director: Marissa Falco submit all requests online at cengage.com/permissions
Further permissions questions can be emailed to
Text Designer: Shawn Girsberger [email protected]
Cover Designer: Cabbage Design Company
Cover Image: iStockphoto Library of Congress Control Number: 2009938501
Print Buyer: Julio Esperas
ISBN-13: 978-0-5387-4476-8
Copy Editor: Michael Beckett
ISBN-10: 0-538-74476-6
Proofreader: Vicki Zimmer
Indexer: Alexandra Nickerson Course Technology
Compositor: Integra 20 Channel Center Street
Boston, MA 02210
USA

Some of the product names and company names used in this book have
been used for identification purposes only and may be trademarks or
registered trademarks of their respective manufacturers and sellers.

Course Technology, a part of Cengage Learning, reserves the right to revise


this publication and make changes from time to time in its content without
notice.

Cengage Learning is a leading provider of customized learning solutions with


office locations around the globe, including Singapore, the United Kingdom,
Australia, Mexico, Brazil, and Japan. Locate your local office at:
www.cengage.com/global

Cengage Learning products are represented in Canada by


Nelson Education, Ltd.

To learn more about Course Technology, visit


www.cengage.com/coursetechnology

Purchase any of our products at your local college store or at our preferred
online store www.ichapters.com

Printed in Canada
1 2 3 4 5 6 7 14 13 12 11 10
Brief Contents
v

Pref ace . . . . . . . . . . . . . . . . . xvi


CHAPTER 1 An Overview of Computers and Programming . . 1
CHAP TER 2 Wo r k in g wi t h Data, Creati ng Modul es,
an d Des ig ni ng Hi gh- Qual i ty Programs . . . . 41
CHAP TER 3 U n der s t an di ng Structure . . . . . . . . . . 92
CHAP TER 4 M ak in g De ci si o ns . . . . . . . . . . . . 133
CHAP TER 5 Lo o pin g . . . . . . . . . . . . . . . . 184
CHAP TER 6 Ar r ays . . . . . . . . . . . . . . . . . 228
CHAP TER 7 F ile Han dli ng and Appl i cati ons . . . . . . 276
CHAPTER 8 Advan ced A rray Concepts, I ndex ed Fi l es,
an d Lin k ed Li st s . . . . . . . . . . . . . 325
CHAPTER 9 Advan ced Mo dul ari zati on Techni ques . . . . 370
CHAPTER 10 Object -Or ient ed Programmi ng . . . . . . . 426
CHAPTER 11 M o re Obje ct - Ori ented Programmi ng
Co n cept s . . . . . . . . . . . . . . . . 469
CHAPTER 12 E ven t -Dr iven GUI Programmi ng,
M u lt it h readi ng , and Ani mati on . . . . . . . 515
CHAPTER 13 Sys t em M o del i ng wi th the UML . . . . . . 550
CHAPTER 14 U s in g Relat i o nal Databases . . . . . . . . 585
APPEN DIX A U n der s t andi ng Numberi ng Sy stems
an d Co m put er Codes . . . . . . . . . . . 637
APPEN DIX B F lo w ch ar t Sy m bol s . . . . . . . . . . . 646
BRIEF CONTENTS

APPEN DIX C St r u ct u res . . . . . . . . . . . . . . . 647


APPEN DIX D So lvin g Dif f icul t Structuri ng Probl ems . . . 649
APPEN DIX E Creat in g Pr int Char ts . . . . . . . . . . 658
vi APPEN DIX F Tw o Var iat io ns o n the Basi c Structures—
c a s e an d d o-while . . . . . . . . . . 660
Glo s s ar y . . . . . . . . . . . . . . . . 666
In dex . . . . . . . . . . . . . . . . . 681
Contents
vii

Pref ace . . . . . . . . . . . . . . . . . xvi

CHAP TER 1 An Over view o f Computers


an d Pro g r am m i ng . . . . . . . . . . . . . 1
Understanding Computer Systems. . . . . . . . . . . . . . 2
Understanding Simple Program Logic . . . . . . . . . . . . 5
Understanding the Program Development Cycle . . . . . . . 8
Understanding the Problem . . . . . . . . . . . . . . . . 8
Planning the Logic . . . . . . . . . . . . . . . . . . . . 10
Coding the Program . . . . . . . . . . . . . . . . . . . 10
Using Software to Translate the Program
into Machine Language . . . . . . . . . . . . . . . . . 11
Testing the Program . . . . . . . . . . . . . . . . . . . 12
Putting the Program into Production . . . . . . . . . . . . 14
Maintaining the Program . . . . . . . . . . . . . . . . . 14
Using Pseudocode Statements and Flowchart Symbols . . . . 15
Writing Pseudocode . . . . . . . . . . . . . . . . . . . 15
Drawing Flowcharts . . . . . . . . . . . . . . . . . . . 17
Repeating Instructions . . . . . . . . . . . . . . . . . . 18
Using a Sentinel Value to End a Program . . . . . . . . . . . 20
Understanding Programming and User Environments . . . . . 23
Understanding Programming Environments . . . . . . . . . 23
Understanding User Environments . . . . . . . . . . . . . 25
Understanding the Evolution of Programming Models . . . . . 27
Chapter Summary . . . . . . . . . . . . . . . . . . . . . 28
Key Terms . . . . . . . . . . . . . . . . . . . . . . . . 29
Review Questions . . . . . . . . . . . . . . . . . . . . . 32
Exercises . . . . . . . . . . . . . . . . . . . . . . . . . 37

CHAP TER 2 Wo r k in g w i t h Data, Creati ng Modul es,


an d Des igni ng Hi gh- Qual i ty Programs . . . . . . 41
Declaring and Using Variables and Constants . . . . . . . . . 42
CONTENTS

Working with Variables . . . . . . . . . . . . . . . . . . 42


Naming Variables . . . . . . . . . . . . . . . . . . . . 44
Understanding Unnamed, Literal Constants
and their Data Types . . . . . . . . . . . . . . . . . . 45
Understanding the Data Types of Variables . . . . . . . . . 46
viii
Declaring Named Constants. . . . . . . . . . . . . . . . 47
Assigning Values to Variables . . . . . . . . . . . . . . . . 48
Performing Arithmetic Operations . . . . . . . . . . . . . 49
Understanding the Advantages of Modularization . . . . . . . 52
Modularization Provides Abstraction . . . . . . . . . . . . 53
Modularization Allows Multiple Programmers
to Work on a Problem . . . . . . . . . . . . . . . . . . 54
Modularization Allows You to Reuse Your Work . . . . . . . 54
Modularizing a Program . . . . . . . . . . . . . . . . . . 55
Declaring Variables and Constants
within Modules . . . . . . . . . . . . . . . . . . . . . 59
Understanding the Most Common Configuration
for Mainline Logic . . . . . . . . . . . . . . . . . . . . 61
Creating Hierarchy Charts . . . . . . . . . . . . . . . . . 66
Features of Good Program Design . . . . . . . . . . . . . . 68
Using Program Comments . . . . . . . . . . . . . . . . 69
Choosing Identifiers . . . . . . . . . . . . . . . . . . . 71
Designing Clear Statements. . . . . . . . . . . . . . . . 72
Writing Clear Prompts and Echoing Input . . . . . . . . . . 74
Maintaining Good Programming Habits . . . . . . . . . . . 76
Chapter Summary . . . . . . . . . . . . . . . . . . . . . 77
Key Terms . . . . . . . . . . . . . . . . . . . . . . . . 78
Review Questions . . . . . . . . . . . . . . . . . . . . . 82
Exercises . . . . . . . . . . . . . . . . . . . . . . . . . 86

CHAPTER 3 U n der s t an ding St ructure . . . . . . . . . . 92


Understanding Unstructured Spaghetti Code . . . . . . . . . 93
Understanding the Three Basic Structures . . . . . . . . . . 95
Using a Priming Input to Structure a Program . . . . . . . 103
Understanding the Reasons for Structure . . . . . . . . . 110
Recognizing Structure . . . . . . . . . . . . . . . . . . 111
Structuring and Modularizing Unstructured Logic . . . . . . 115
Chapter Summary . . . . . . . . . . . . . . . . . . . . 121
Key Terms . . . . . . . . . . . . . . . . . . . . . . . 122
Review Questions . . . . . . . . . . . . . . . . . . . . 123
Exercises . . . . . . . . . . . . . . . . . . . . . . . . 127
CONTENTS

CHAP TER 4 M ak in g Deci si o ns . . . . . . . . . . . . 133


Evaluating Boolean Expressions to Make Comparisons . . . 134
Using Relational Comparison Operators . . . . . . . . . . 137
Avoiding a Common Error with Relational Operators . . . . 141
Understanding AND Logic . . . . . . . . . . . . . . . . 141
Nesting AND Decisions for Efficiency . . . . . . . . . . 144 ix
Using the AND Operator . . . . . . . . . . . . . . . . 146
Avoiding Common Errors in an AND Selection. . . . . . . 148
Understanding OR Logic . . . . . . . . . . . . . . . . . 150
Writing OR Decisions for Efficiency . . . . . . . . . . . 152
Using the OR Operator . . . . . . . . . . . . . . . . . 153
Avoiding Common Errors in an OR Selection . . . . . . . 155
Making Selections within Ranges . . . . . . . . . . . . . 159
Avoiding Common Errors When Using Range Checks . . . 162
Understanding Precedence When Combining
AND and OR Operators . . . . . . . . . . . . . . . . . 166
Chapter Summary . . . . . . . . . . . . . . . . . . . . 169
Key Terms . . . . . . . . . . . . . . . . . . . . . . . 170
Review Questions . . . . . . . . . . . . . . . . . . . . 171
Exercises . . . . . . . . . . . . . . . . . . . . . . . . 177

CHAP TER 5 Lo o pin g . . . . . . . . . . . . . . . . 184


Understanding the Advantages of Looping . . . . . . . . . 185
Using a Loop Control Variable. . . . . . . . . . . . . . . 186
Using a Definite Loop with a Counter . . . . . . . . . . 187
Using an Indefinite Loop with a Sentinel Value . . . . . . 188
Understanding the Loop in a Program’s Mainline Logic. . . 190
Nested Loops . . . . . . . . . . . . . . . . . . . . . . 192
Avoiding Common Loop Mistakes . . . . . . . . . . . . . 196
Mistake: Neglecting to Initialize the
Loop Control Variable . . . . . . . . . . . . . . . . . 197
Mistake: Neglecting to Alter the
Loop Control Variable . . . . . . . . . . . . . . . . . 198
Mistake: Using the Wrong Comparison with the
Loop Control Variable . . . . . . . . . . . . . . . . . 200
Mistake: Including Statements Inside the Loop
that Belong Outside the Loop . . . . . . . . . . . . . 201
Using a for Loop . . . . . . . . . . . . . . . . . . . . 206
Common Loop Applications . . . . . . . . . . . . . . . . 208
Using a Loop to Accumulate Totals . . . . . . . . . . . 208
Using a Loop to Validate Data . . . . . . . . . . . . . . 211
Limiting a Reprompting Loop . . . . . . . . . . . . . . 213
CONTENTS

Validating a Data Type . . . . . . . . . . . . . . . . . 215


Validating Reasonableness and Consistency of Data . . . . 216
Chapter Summary . . . . . . . . . . . . . . . . . . . . 217
Key Terms . . . . . . . . . . . . . . . . . . . . . . . 218
Review Questions . . . . . . . . . . . . . . . . . . . . 219
x
Exercises . . . . . . . . . . . . . . . . . . . . . . . . 223

CHAPTER 6 Ar r ays . . . . . . . . . . . . . . . . . 228


Understanding Arrays and How They Occupy
Computer Memory . . . . . . . . . . . . . . . . . . . 229
How Arrays Occupy Computer Memory . . . . . . . . . . 229
Manipulating an Array to Replace Nested Decisions . . . . . 232
Using Constants with Arrays . . . . . . . . . . . . . . . 240
Using a Constant as the Size of an Array . . . . . . . . . 240
Using Constants as Array Element Values . . . . . . . . 241
Using a Constant as an Array Subscript . . . . . . . . . 241
Searching an Array . . . . . . . . . . . . . . . . . . . 242
Using Parallel Arrays . . . . . . . . . . . . . . . . . . . 246
Improving Search Efficiency. . . . . . . . . . . . . . . 251
Searching an Array for a Range Match . . . . . . . . . . . 254
Remaining within Array Bounds . . . . . . . . . . . . . . 258
Using a for Loop to Process Arrays . . . . . . . . . . . 261
Chapter Summary . . . . . . . . . . . . . . . . . . . . 262
Key Terms . . . . . . . . . . . . . . . . . . . . . . . 263
Review Questions . . . . . . . . . . . . . . . . . . . . 264
Exercises . . . . . . . . . . . . . . . . . . . . . . . . 268

CHAPTER 7 F ile Han dlin g and Appl i cati ons . . . . . . 276


Understanding Computer Files . . . . . . . . . . . . . . 277
Organizing Files . . . . . . . . . . . . . . . . . . . . 278
Understanding the Data Hierarchy . . . . . . . . . . . . . 279
Performing File Operations . . . . . . . . . . . . . . . . 280
Declaring a File . . . . . . . . . . . . . . . . . . . . 280
Opening a File . . . . . . . . . . . . . . . . . . . . . 281
Reading Data From a File . . . . . . . . . . . . . . . . 281
Writing Data to a File . . . . . . . . . . . . . . . . . . 283
Closing a File . . . . . . . . . . . . . . . . . . . . . 283
A Program that Performs File Operations . . . . . . . . . 283
Understanding Sequential Files and Control Break Logic . . . 286
Understanding Control Break Logic . . . . . . . . . . . 287
Merging Sequential Files . . . . . . . . . . . . . . . . . 293
Master and Transaction File Processing . . . . . . . . . . 303
CONTENTS

Random Access Files . . . . . . . . . . . . . . . . . . 311


Chapter Summary . . . . . . . . . . . . . . . . . . . . 313
Key Terms . . . . . . . . . . . . . . . . . . . . . . . 314
Review Questions . . . . . . . . . . . . . . . . . . . . 316
Exercises . . . . . . . . . . . . . . . . . . . . . . . . 320
xi
CHAP TER 8 Advan ced A rray Concepts, I ndex ed Fi l es,
an d Lin k ed Li st s . . . . . . . . . . . . . 325
Understanding the Need for Sorting Records . . . . . . . . 326
Understanding How to Swap Two Values . . . . . . . . . . 327
Using a Bubble Sort . . . . . . . . . . . . . . . . . . . 329
Sorting a List of Variable Size . . . . . . . . . . . . . . 337
Refining the Bubble Sort to Reduce Unnecessary
Comparisons. . . . . . . . . . . . . . . . . . . . . 341
Refining the Bubble Sort to Eliminate Unnecessary
Passes . . . . . . . . . . . . . . . . . . . . . . . 343
Other Sorts . . . . . . . . . . . . . . . . . . . . . . 345
Using Multidimensional Arrays . . . . . . . . . . . . . . 345
Using Indexed Files and Linked Lists. . . . . . . . . . . . 352
Using Indexed Files . . . . . . . . . . . . . . . . . . 352
Using Linked Lists . . . . . . . . . . . . . . . . . . . 354
Chapter Summary . . . . . . . . . . . . . . . . . . . . 357
Key Terms . . . . . . . . . . . . . . . . . . . . . . . 358
Review Questions . . . . . . . . . . . . . . . . . . . . 359
Exercises . . . . . . . . . . . . . . . . . . . . . . . . 364

CHAPTER 9 Advan ced Mo dul ari zati on Techni ques . . . . 370


Using Methods with No Parameters . . . . . . . . . . . . 371
Creating Methods that Require a Single Parameter . . . . . 374
Creating Methods that Require Multiple Parameters . . . . . 379
Creating Methods that Return a Value . . . . . . . . . . . 381
Using an IPO Chart . . . . . . . . . . . . . . . . . . . 387
Passing an Array to a Method . . . . . . . . . . . . . . . 388
Overloading Methods. . . . . . . . . . . . . . . . . . . 395
Avoiding Ambiguous Methods . . . . . . . . . . . . . . . 398
Using Predefined Methods . . . . . . . . . . . . . . . . 401
Method Design Issues: Implementation Hiding, Cohesion,
and Coupling . . . . . . . . . . . . . . . . . . . . . 403
Understanding Implementation Hiding . . . . . . . . . . 403
Increasing Cohesion . . . . . . . . . . . . . . . . . . 404
Reducing Coupling . . . . . . . . . . . . . . . . . . . 405
Understanding Recursion . . . . . . . . . . . . . . . . . 407
CONTENTS

Chapter Summary . . . . . . . . . . . . . . . . . . . . 411


Key Terms . . . . . . . . . . . . . . . . . . . . . . . 413
Review Questions . . . . . . . . . . . . . . . . . . . . 415
Exercises . . . . . . . . . . . . . . . . . . . . . . . . 419

xii CHAPTER 10 Object -Or ient ed Programmi ng . . . . . . . 426


Principles of Object-Oriented Programming . . . . . . . . . 427
Classes and Objects . . . . . . . . . . . . . . . . . . 427
Polymorphism . . . . . . . . . . . . . . . . . . . . . 430
Inheritance . . . . . . . . . . . . . . . . . . . . . . 431
Encapsulation . . . . . . . . . . . . . . . . . . . . . 432
Defining Classes and Creating Class Diagrams . . . . . . . 433
Creating Class Diagrams . . . . . . . . . . . . . . . . 435
The Set Methods . . . . . . . . . . . . . . . . . . . . 438
The Get Methods. . . . . . . . . . . . . . . . . . . . 440
Work Methods . . . . . . . . . . . . . . . . . . . . . 440
Understanding Public and Private Access . . . . . . . . . 442
Organizing Classes . . . . . . . . . . . . . . . . . . . 446
Understanding Instance Methods . . . . . . . . . . . . . 447
Understanding Static Methods . . . . . . . . . . . . . . 453
Using Objects . . . . . . . . . . . . . . . . . . . . . . 455
Chapter Summary . . . . . . . . . . . . . . . . . . . . 459
Key Terms . . . . . . . . . . . . . . . . . . . . . . . 460
Review Questions . . . . . . . . . . . . . . . . . . . . 462
Exercises . . . . . . . . . . . . . . . . . . . . . . . . 466

CHAPTER 11 M o re Object - Ori ented Programmi ng


Co n cept s . . . . . . . . . . . . . . . . 469
An Introduction to Constructors . . . . . . . . . . . . . . 470
Constructors with Parameters . . . . . . . . . . . . . . 473
Overloading Class Methods and Constructors. . . . . . . 473
Understanding Destructors . . . . . . . . . . . . . . . . 476
Understanding Composition . . . . . . . . . . . . . . . . 478
Understanding Inheritance . . . . . . . . . . . . . . . . 479
Understanding Inheritance Terminology . . . . . . . . . 481
Accessing Private Members of a Parent Class . . . . . . 484
Using Inheritance to Achieve Good Software Design . . . . 490
One Example of Using Predefined Classes:
Creating GUI Objects . . . . . . . . . . . . . . . . . . 491
Understanding Exception Handling. . . . . . . . . . . . . 493
Drawbacks to Traditional Error-Handling Techniques . . . . 493
The Object-Oriented Exception Handling Model . . . . . . 495
CONTENTS

Using Built-in Exceptions and Creating Your Own


Exceptions. . . . . . . . . . . . . . . . . . . . . . 498
Reviewing the Advantages of Object-Oriented
Programming . . . . . . . . . . . . . . . . . . . . . 499
Chapter Summary . . . . . . . . . . . . . . . . . . . . 500
Key Terms . . . . . . . . . . . . . . . . . . . . . . . 502 xiii
Review Questions . . . . . . . . . . . . . . . . . . . . 503
Exercises . . . . . . . . . . . . . . . . . . . . . . . . 508

CHAPTER 12 E ven t -Dr iven GUI Programmi ng,


M u lt it h readi ng , and Ani mati on . . . . . . . 515
Understanding Event-Driven Programming . . . . . . . . . 516
User-Initiated Actions and GUI Components. . . . . . . . . 519
Designing Graphical User Interfaces . . . . . . . . . . . . 523
The Interface Should Be Natural and Predictable . . . . . 523
The Interface Should Be Attractive, Easy to Read, and
Nondistracting . . . . . . . . . . . . . . . . . . . . 524
To Some Extent, It’s Helpful If the User Can
Customize Your Applications. . . . . . . . . . . . . . 524
The Program Should Be Forgiving . . . . . . . . . . . . 525
The GUI Is Only a Means to an End . . . . . . . . . . . 525
The Steps to Developing an Event-Driven Application . . . . 526
Creating Storyboards. . . . . . . . . . . . . . . . . . 527
Defining the Storyboard’s Objects in
an Object Dictionary . . . . . . . . . . . . . . . . . 527
Defining Connections Between the User Screens . . . . . 528
Planning the Logic . . . . . . . . . . . . . . . . . . . 529
Understanding Multithreading . . . . . . . . . . . . . . . 535
Creating Animation. . . . . . . . . . . . . . . . . . . . 537
Chapter Summary . . . . . . . . . . . . . . . . . . . . 540
Key Terms . . . . . . . . . . . . . . . . . . . . . . . 541
Review Questions . . . . . . . . . . . . . . . . . . . . 542
Exercises . . . . . . . . . . . . . . . . . . . . . . . . 546

CHAPTER 13 Sys t em M o del i ng wi th the UML . . . . . . 550


Understanding the Need for System Modeling . . . . . . . 551
What is the UML? . . . . . . . . . . . . . . . . . . . . 552
Using Use Case Diagrams . . . . . . . . . . . . . . . . 554
Using Class and Object Diagrams . . . . . . . . . . . . . 560
Using Sequence and Communication Diagrams . . . . . . . 564
Using State Machine Diagrams . . . . . . . . . . . . . . 566
Using Activity Diagrams . . . . . . . . . . . . . . . . . 567
CONTENTS

Using Component, Deployment, and Profile Diagrams . . . . 570


Diagramming Exception Handling . . . . . . . . . . . . . 572
Deciding When to Use the UML and Which
UML Diagrams to Use . . . . . . . . . . . . . . . . . 573
Chapter Summary . . . . . . . . . . . . . . . . . . . . 575
xiv
Key Terms . . . . . . . . . . . . . . . . . . . . . . . 576
Review Questions . . . . . . . . . . . . . . . . . . . . 578
Exercises . . . . . . . . . . . . . . . . . . . . . . . . 582

CHAPTER 14 U s in g Relat i o nal Databases . . . . . . . . 585


Understanding Relational Database Fundamentals . . . . . . 586
Creating Databases and Table Descriptions . . . . . . . . 588
Identifying Primary Keys . . . . . . . . . . . . . . . . . 591
Understanding Database Structure Notation . . . . . . . . 594
Adding, Deleting, Updating, and Sorting Records
within Tables. . . . . . . . . . . . . . . . . . . . . . 595
Sorting the Records in a Table . . . . . . . . . . . . . 596
Creating Queries. . . . . . . . . . . . . . . . . . . . . 596
Understanding Relationships Between Tables . . . . . . . . 600
Understanding One-to-Many Relationships . . . . . . . . 600
Understanding Many-to-Many Relationships . . . . . . . . 601
Understanding One-to-One Relationships . . . . . . . . . 606
Recognizing Poor Table Design . . . . . . . . . . . . . . 607
Understanding Anomalies, Normal Forms,
and Normalization . . . . . . . . . . . . . . . . . . . 609
First Normal Form . . . . . . . . . . . . . . . . . . . 610
Second Normal Form . . . . . . . . . . . . . . . . . . 612
Third Normal Form . . . . . . . . . . . . . . . . . . . 615
Database Performance and Security Issues . . . . . . . . 618
Providing Data Integrity. . . . . . . . . . . . . . . . . 618
Recovering Lost Data . . . . . . . . . . . . . . . . . 619
Avoiding Concurrent Update Problems . . . . . . . . . . 619
Providing Authentication and Permissions . . . . . . . . 620
Providing Encryption . . . . . . . . . . . . . . . . . . 620
Chapter Summary . . . . . . . . . . . . . . . . . . . . 621
Key Terms . . . . . . . . . . . . . . . . . . . . . . . 622
Review Questions . . . . . . . . . . . . . . . . . . . . 625
Exercises . . . . . . . . . . . . . . . . . . . . . . . . 630
CONTENTS

APPEN DIX A U n der s t andi ng Numberi ng Sy stems


an d Co m put er Codes . . . . . . . . . . . 637

APPEN DIX B F lo w ch ar t Sy m bol s . . . . . . . . . . . 646


xv
APPEN DIX C St r u ct u res . . . . . . . . . . . . . . . 647

APPEN DIX D So lvin g Di f f i cul t Structuri ng Probl ems . . . 649

APPEN DIX E Creat in g Pri nt Char ts . . . . . . . . . . 658

APPEN DIX F Tw o Var iati o ns on the Basi c Structures—


c a s e an d do-while . . . . . . . . . . 660

Glo s s ar y . . . . . . . . . . . . . . . . 666

In dex . . . . . . . . . . . . . . . . . 681
Preface
xvi

Programming Logic and Design, Comprehensive, Sixth Edition


provides the beginning programmer with a guide to developing
structured program logic. This textbook assumes no programming
language experience. The writing is nontechnical and emphasizes
good programming practices. The examples are business examples;
they do not assume mathematical background beyond high school
business math. Additionally, the examples illustrate one or two major
points; they do not contain so many features that students become
lost following irrelevant and extraneous details.
The examples in Programming Logic and Design have been created to
provide students with a sound background in logic, no matter what
programming languages they eventually use to write programs. This
book can be used in a stand-alone logic course that students take as a
prerequisite to a programming course, or as a companion book to an
introductory programming text using any programming language.

Organization and Coverage


Programming Logic and Design, Comprehensive, Sixth Edition
introduces students to programming concepts and enforces good
style and logical thinking. General programming concepts are intro-
duced in Chapter 1. Chapter 2 discusses using data and introduces
two important concepts: modularization and creating high-quality
programs. It is important to emphasize these topics early so that
students start thinking in a modular way and concentrate on making
their programs efficient, robust, easy to read, and easy to maintain.
Chapter 3 covers the key concepts of structure, including what
structure is, how to recognize it, and most importantly, the advan-
tages to writing structured programs. This early overview gives
students a solid foundation for thinking in a structured way before
they have to manage the details of the structures.
Chapters 4, 5, and 6 explore the intricacies of decision making, looping,
and array manipulation. Chapter 7 provides details of file handling so
students can create programs that handle a significant amount of data.
P R E FA C E

In Chapters 8 and 9, students learn more advanced techniques in


array manipulation and modularization. Chapters 10 and 11 provide
a thorough, yet accessible, introduction to concepts and terminology
used in object-oriented programming. Students learn about classes,
objects, instance and static class members, constructors, destructors,
inheritance, and the advantages provided by object-oriented thinking.
xvii
Chapter 12 explores additional object-oriented programming issues:
event-driven GUI programming, multithreading, and animation.
Chapter 13 discusses system design issues and details the features of
the Unified Modeling Language. Chapter 14 is a thorough introduc-
tion to the most important database concepts business programmers
should understand.
The first three appendices give students summaries of numbering
systems, flowchart symbols, and structures. Additional appendices
allow students to gain extra experience with structuring large
unstructured programs, creating print charts, and understanding
posttest loops and case structures.
Programming Logic and Design combines text explanation with
flowcharts and pseudocode examples to provide students with
alternative means of expressing structured logic. Numerous detailed,
full-program exercises at the end of each chapter illustrate the
concepts explained within the chapter, and reinforce understanding
and retention of the material presented.
Programming Logic and Design distinguishes itself from other
programming logic books in the following ways:
• It is written and designed to be non-language specific. The logic
used in this book can be applied to any programming language.
• The examples are everyday business examples; no special knowledge
of mathematics, accounting, or other disciplines is assumed.
• The concept of structure is covered earlier than in many other
texts. Students are exposed to structure naturally, so they will
automatically create properly designed programs.
• Text explanation is interspersed with flowcharts and pseudocode
so students can become comfortable with both logic development
tools and understand their interrelationship. Screen shots of
running programs also are included, providing students with a
clear and concrete image of the programs’ execution.
• Complex programs are built through the use of complete business
examples. Students see how an application is constructed from
start to finish instead of studying only segments of programs.
P R E FA C E

Features
This edition of the text includes many features to help students
become better programmers and understand the big picture in
program development. Many new features have been added, and the
popular features from the first five editions are still included.
xviii
Features maintained from previous editions include:
OBJECTIVES Each chapter begins with a list of objectives so the
student knows the topics that will be presented in the chapter. In
addition to providing a quick reference to topics covered, this feature
provides a useful study aid.
FLOWCHARTS This book has plenty of figures and illustrations,
including flowcharts, which provide the reader with a visual learning
experience, rather than one that involves simply studying text. You
can see examples of flowcharts beginning in Chapter 1.
PSEUDOCODE This book also includes numerous examples of
pseudocode, which illustrate correct usage of the programming logic
and design concepts being taught.
NOTES These tips provide additional information—for
example, another location in the book that expands on a topic,
or a common error to watch out for.
THE DON’T DO IT ICON It is sometimes illustrative to
show an example of how NOT to do something—for
example, having a dead code path in a program. However,
students do not always read carefully and sometimes use logic similar
to that shown in what is intended to be a “bad” example. When the
instructor is critical, the frustrated student says, “But that’s how they
did it in the book!” Therefore, although the text will continue to
describe bad examples, and the captions for the related figures will
mention that they are bad examples, the book also includes a “Don’t
Do It” icon near the offending section of logic. This icon provides a
visual jolt to the student, emphasizing that particular figures are NOT
to be emulated.
THE TWO TRUTHS AND A LIE QUIZ This quiz appears after each
chapter section, with answers provided. The quiz contains three
statements based on the preceding section of text—two true and one
false. Over the years, students have requested answers to problems,
but we have hesitated to distribute them in case instructors want
to use problems as assignments or test questions. These true-false
mini-quizzes provide students with immediate feedback as they read,
without “giving away” answers to the multiple-choice questions and
programming problems later in the chapter.
P R E FA C E

GAME ZONE EXERCISES These exercises are included at the


end of each chapter. Students can create games as an
additional entertaining way to understand key concepts
presented in the chapter.
CHAPTER SUMMARIES Following each chapter is a summary that
recaps the programming concepts and techniques covered in the xix
chapter. This feature provides a concise means for students to review
and check their understanding of the main points in each chapter.
KEY TERMS Each chapter lists key terms and their definitions; the list
appears in the order the terms are encountered in the chapter. Along
with the chapter summary, the list of key terms provides a snapshot
overview of a chapter’s main ideas. A glossary at the end of the book lists
all the key terms in alphabetical order, along with working definitions.
DEBUGGING EXERCISES Because examining programs
critically and closely is a crucial programming skill, each
chapter includes a “Find the Bugs” section in which program-
ming examples are presented that contain syntax errors and logical
errors for the student to find and correct.
REVIEW QUESTIONS Twenty multiple-choice review questions
appear at the end of every chapter to allow students to test their
comprehension of the major ideas and techniques presented.
EXERCISES Multiple end-of-chapter flowcharting and pseudocoding
exercises are included so students have more opportunities to practice
concepts as they learn them. These exercises increase in difficulty and
are designed to allow students to explore logical programming concepts.
Each exercise can be completed using flowcharts, pseudocode, or both.
In addition, instructors can assign the exercises as programming prob-
lems to be coded and executed in a particular programming language.
ESSAY QUESTIONS Each chapter contains an “Up For
Discussion” section in which questions present personal and
ethical issues that programmers must consider. These ques-
tions can be used for written assignments or as a starting point for
classroom discussions.

New to this Edition!


VIDEO LESSONS Each chapter is accompanied by two or
more video lessons that help explain an important chapter
concept. A listing of the videos provided can be found on
the inside back cover of this text. These videos are designed
and narrated by the author and are available for free with a new book.
(They can also be purchased separately at iChapters.com.)
P R E FA C E

If you have a new book, it will contain a URL and PIN code. Once you
go to this URL and enter your PIN code, follow the prompts to locate
the videos for this text. If you are a user of an online course cartridge,
such as BlackBoard, WebCT, or Angel, you will also have access to
these videos through that platform.
xx INCREASED EMPHASIS ON MODULARITY From the second chapter,
students are encouraged to write code in concise, easily manageable,
and reusable modules. Instructors have found that modularization
is a technique that should be encouraged early to instill good habits
and a clearer understanding of structure. This edition explains
modularization early, using global variables instead of local passed
and returned values, and saves parameter passing for later when the
student has become more adept.
CLEARER EXPLANATIONS This edition has been rewritten to
provide clearer, simpler explanations that are appropriate for the
beginning programming student. As a result of the new, cleaner
approach, the length of the book has been reduced.
NEW APPENDICES FOR EASY REFERENCE New appendices
have been added that cover numbering systems, flowchart symbols,
and structures.
DECREASED EMPHASIS ON CONTROL BREAKS Professional
programmers should understand control break logic, but creating
such logic is not as common a task as it was years ago. Therefore, the
topic is still covered briefly as part of the file-handling chapter, but
with reduced emphasis from previous editions of the book.

Instructor Resources
The following supplemental materials are available when this
book is used in a classroom setting. All of the instructor resources
available with this book are provided to the instructor on a single
CD-ROM.
ELECTRONIC INSTRUCTOR’S MANUAL The Instructor’s Manual
that accompanies this textbook provides additional instructional
material to assist in class preparation, including items such as Sample
Syllabi, Chapter Outlines, Technical Notes, Lecture Notes, Quick
Quizzes, Teaching Tips, Discussion Topics, and Key Terms.
EXAMVIEW® This textbook is accompanied by ExamView, a powerful
testing software package that allows instructors to create and admin-
ister printed, computer (LAN-based), and Internet exams. ExamView
includes hundreds of questions that correspond to the topics covered in
this text, enabling students to generate detailed study guides that include
page references for further review. The computer-based and Internet
P R E FA C E

testing components allow students to take exams at their computers,


and save the instructor time by grading each exam automatically.
POWERPOINT PRESENTATIONS This book comes with Microsoft
PowerPoint© slides for each chapter. These are included as a teach-
ing aid for classroom presentation, to make available to students
on your network for chapter review, or to be printed for classroom xxi
distribution. Instructors can add their own slides for additional topics
they introduce to the class.
SOLUTIONS Suggested solutions to Review Questions and Exercises
are provided on the Instructor Resources CD and may also be found
on the Course Technology Web site at www.cengage.com/coursetech-
nology. The solutions are password protected.
DISTANCE LEARNING Course Technology offers WebCT© and
Blackboard© courses for this text to provide the most complete and
dynamic learning experience possible. When you add online content
to one of your courses, you’re adding a lot: automated tests, topic
reviews, quick quizzes, and additional case projects with solutions.
For more information on how to bring distance learning to your
course, contact your Course Technology sales representative.

Software Options
You have the option to bundle software with your text! Please contact
your Course Technology sales representative for more information.
MICROSOFT ® OFFICE VISIO ® PROFESSIONAL Visio is a
diagramming program that helps users create flowcharts and
diagrams easily while working through the text, enabling them to
visualize concepts and learn more effectively.
VISUAL LOGIC ™ This simple but powerful tool teaches program-
ming logic and design without traditional high-level programming
language syntax. Visual Logic uses flowcharts to explain essential
programming concepts, including variables, input, assignment, out-
put, conditions, loops, procedures, graphics, arrays, and files. It also
has the ability to interpret and execute flowcharts, providing students
with immediate and accurate feedback about their solutions. By exe-
cuting student solutions, Visual Logic combines the power of a high-
level language with the ease and simplicity of flowcharts.

Acknowledgments
I would like to thank all of the people who helped to make this book
a reality, especially Dan Seiter, Development Editor, whose hard work
and attention to detail have made this a high-quality textbook. I have
P R E FA C E

worked with Dan for many years now, and he is indispensable in pro-
ducing accurate and approachable technical instruction. Thanks also
to Tricia Coia, Managing Editor; Amy Jollymore, Acquisitions Editor;
Jennifer Feltri, Content Project Manager; and Green Pen QA, Technical
Editors. I am grateful to be able to work with so many fine people who
are dedicated to producing high-quality instructional materials.
xxii
I am grateful to the many reviewers who provided helpful and
insightful comments during the development of this book, including
Gilbert Armour, Virginia Western Community College; John Buerck,
Saint Louis University; Karen Cummings, McLennan Community
College; Clara Groeper, Illinois Central College; and Jeff Hedrington,
Colorado Technical University.
Thanks, too, to my husband, Geoff, and our daughters, Andrea and
Audrey, for their support. This book, as were all its previous editions,
is dedicated to them.
–Joyce Farrell
P R E FA C E

About the Inside Front Cover


Check out our interviews with recent graduates who are now
working in the IT field. One is featured on the inside front cover
of this book. If you know people who recently landed a job in IT,
we’d like to interview them too! Send your suggestions via e-mail to
Amy Jollymore, Acquisitions Editor, at [email protected]. xxiii
Exploring the Variety of Random
Documents with Different Content
1883 The Walker News, started at Walker by David Brant.
The Daily Gazette, started in Cedar Rapids by Otis &
Post.
1884 The Gazette Company organized in March and takes
over the Daily Gazette. In July all the stock purchased
by Fred W. Faulkes and Clarence L. Miller.
The Saturday Evening Chat, started in Cedar Rapids
by A. J. Huss.
The Linn County Pilot becomes the Marion Pilot, Rev.
J. W. Chaffee, editor.
1886 The Linn County Independent removes to Marion.
1888 Kvinden og Hjemmet, monthly illustrated magazine
for the Norwegian and Danish women in America,
with a Swedish edition, Quinnan och Hemmet, started
at Cedar Rapids by N. Fr. Hansen.
The News-Letter, started at Central City.
1889 Town Topics, started in Cedar Rapids by Ernest A.
Sherman.
The Monitor, started at Coggon.
1891 Saturday Record, started in Cedar Rapids by Sherman
& Hatmaker.
1894 The Herald, started at Lisbon by W. F. Stahl.
1893 The Record, started at Mt. Vernon by Lloyd
McCutcheon.
1902 Iowa Post brought to Cedar Rapids from Iowa City by
Henry Gundling.
1903 The Tribune, established by the Cedar Rapids
Federation of Labor.
1906 The Cedar Rapidske Liste, Bohemian humorous
weekly.
The Optimus, started at Cedar Rapids by E. C. Barber.
1909 West Side Enterprise, started December 30th by W. I.
Endicott, owner and publisher.
Much of the early history of Linn county, and more especially of
Cedar Rapids, is interwoven with the history of the Progressive Era,
which afterwards became the Cedar Rapids Times. The Progressive
Era was established by D. O. Finch in 1851. It was democratic in
politics and claimed to be devoted to the interests of Cedar Rapids
and Linn county. It was a seven column, four page paper, and rather
a credit to the town at that time. Worse papers have been published
since.
It was but a short time until Mr. Finch had all the newspaper
experience he wanted. Joseph Greene then purchased the paper and
ran it until 1854. During this time Ezra Van Metre, James J. Child,
Esq., and James L. Enos were successively its editors.
James L. Enos had something to do with nearly every paper that
was started during the early days of Linn county. He loved the smell
of printer's ink. The types had a fascination for him. He delighted to
see his thoughts reproduced in print. In September, 1854, he and F.
Augustus Williams purchased Mr. Greene's interest in the Progressive
Era. They changed the name to the Cedar Valley Times. They
changed the politics of the paper from democratic to the new
Americanism of that time. Then came the organization of the
republican party. Like other adherents to the American party living in
the north, the editors of the Times cast in their lot with the new
republican party and warmly advocated and defended the principles
on which it was founded.
One J. G. Davenport figures also in the early history of the Times.
He had acquired an interest in the paper, and during the campaign
he was its nominal editor, although there were not wanting those
who declared that he had not the ability to write a three line notice
of a church supper, let alone an editorial. Anyway, he made the
Times his stepping stone into the postmaster's seat, and his conduct
of that office was such that an investigation of his shortages
followed. His bondsmen, one of whom was the late J. J. Snouffer,
made good the loss, and shortly afterwards Davenport, after some
more operations of a minor character and similar nature, left Cedar
Rapids.
They were rare old political fighters in those days. Politics, rather
than news, was the chief end and aim of the owner of a newspaper.
When Greene, Merritt & Co. closed out Davenport, having held a bill
of sale on the Times office, the Times was made the personal organ
of Colonel William H. Merritt in his campaign against Kirkwood. To do
this it had to change from republicanism to democracy, but it waged
a hot fight, Colonel Merritt being its editor. However, Kirkwood was
elected and in 1862 C. M. Hollis purchased the Times and he made
great success of it up to 1866 when he disposed of the paper to
Ayers and McClelland.
UNITED BRETHREN CHURCH, LISBON
MAIN STREET, MT. VERNON
Much might be written about some of the old printers who helped to
publish those early Linn county newspapers. There has been a host
of them and they have included some notable men. One was no less
a personage than Mr. Rosewater, of the Omaha Bee, who once
worked as a journeyman printer in the office of the Slovan-Americky.
It was when he was on his way to the west. Some of the old printers
have long since passed away. One of the latest of them was Stephen
M. Jones, who died at Hampton four years ago. Concerning his work
here in Cedar Rapids, Captain J. O. Stewart, himself one of the
veteran printers of the state, writes interestingly as follows:
"Stephen Jones commenced to learn the trade in the Progressive Era
office in this city, in the year 1851, serving a four years'
apprenticeship, at the end of which time he went to Vinton and
worked in the Eagle office, at that time conducted by Fred Layman, I
believe. The office of the Progressive Era was located on the corner
of First street and Third avenue, where the Warfield-Pratt-Howell
wholesale building now stands, and was the first paper published in
Cedar Rapids. It was an old frame building erected by the Greene
brothers and formerly used as a store room. At the time of this story
the lower floor front was used on Sundays by the Episcopal church
for service, the printing office was overhead and the back part, three
stories, including basement, was used as a store room for dressed
hogs. 'Steve,' as he was called, and your correspondent were what
was known as 'printer's devils.' After some years residence in Vinton
Steve got about a wheelbarrow load of material and started his
paper in Hampton and christened it the Hampton Chronicle, which is
still among the live, able newspapers in Iowa. He was later
appointed postmaster of Hampton, which position he held for twelve
years.
"There is one other who would rank with us if he is still living, and
he was a few years ago, on his farm near Lone Tree in Johnson
county. His name is Dan Shaffer. Dan, with a Mr. Foster, whose first
name I have forgotten, were employed in the office doing the work
on the Iowa Supreme Court Reports by Justice George Greene,
formerly of this city. This was a book of some 600 or more pages
and an edition of 500 volumes. This book can be found on the
shelves of many of the Iowa lawyers, especially the older
practitioners. This work was all done on a Washington hand press
and 500 impressions was considered a good day's work. Steve's
principal business, until he was relieved by the writer, was to ink the
forms from which the impressions were made. This was done by
passing over the type forms two large rollers made of glue and
molasses, leaving and returning onto a large wooden roller revolved
by a crank at one end, which process equally distributed the ink
which was applied to the two rollers by a still smaller one and
designated the 'brayer'—old printers will recognize the article. For
nearly two years this was the principal part of the writer's duties,
interspersed with hunting up and down the banks of the river
dragging out floating slabs that got away from the saw mills up at
the dam, for fuel for the office, the proprietors being too poor to buy
cordwood at $1.75 per cord. The paper was published by Dan O.
Finch who later became distinguished as a lawyer of high ability. The
last I knew of him, a few years ago, he was still living, making his
home with a son some place on the Pacific coast,—Seattle, I believe.
The other publisher was William Williams, son of Chief Justice
Williams of this state. The material was owned by the Greene
brothers. Some time later the Era office was moved to the building
that stood on the corner where the Rudolph store now is. The
proprietors changed hands pretty often, and finally the paper came
into the hands of Robert and LeRoy McCabe, older brothers of the
famous Chaplain Charles C. McCabe, who then clerked for Greene
Bros. in their store under the printing office. The Masonic lodge
room was in the third story of this building. While the McCabe
brothers conducted the paper your correspondent graduated and
started out as a full fledged journeyman printer. It may be of interest
to the craft of the day to give your correspondent's salary. The first
year he was to receive $35, second $50, third $75, and the fourth
the princely sum of $100. Out of this he was supposed to pay his
board and furnish his clothing. The first job he secured after his
apprenticeship was $10 per week and pay his own board. This was
in the year 1856.
"The tramping jour. printers of those days, like Bret Harte's Heathen
Chinee, were peculiar. As a class they were the best of workmen;
bright and intelligent, knowing the 'art preservative' thoroughly, but
possessed of that roving disposition so common to all printers of
that time, and many of them given to drink. They would work for a
time and get a little ahead and then get on a 'toot' and seek newer
fields. They often resorted to peculiar methods to procure a job. I
recall an incident while I was yet the 'devil' of the Era office. It was
on the day we were moving the office to the new quarters. The
heavy press and material had to be skidded from the second floor to
the ground through a large door in the front of the building. When
the heavier part of the press was partly down a rather tall, strong
built, intelligent looking man put in an appearance. He watched the
process for a short time not saying a word. Finally he took from his
pocket a slip of dirty paper and wrote on it 'don't you need some
help?' and handed it to the proprietor, Mr. Robert McCabe. He was
asked if he could talk. His reply was simply by signs indicating that
he was deaf and dumb. He proved an excellent help and stayed for
more than three months, never indicating that he could speak. He
was a skilled printer, but cross and particular, and often we 'devils'
called him hard names to his face. But his time had come and he
must have his periodical, and he did. He threw his money to the kids
on the streets and had a jolly time, never once indicating he could
speak. About the third day he came into the office and took Mr.
McCabe to the lodge room above and wrote: 'What will they do to
me if I talk?' Being assured that he would not be harmed and to the
astonishment of the boss he reached out his hand and exclaimed,
'How are you, Bob?' The same surprise was waiting for the rest of
us, and you may be assured we 'devils,' who had been giving him
such choice names, were looking for a chance to hide. He soon left
and I never heard of him again.
"As I have said, the publishers changed often, and for some time
after the McCabe brothers left the paper it was hard to tell just who
did manage the paper, the Greenes owning the material. After many
vicissitudes, which all the papers of that early day had to pass
through, it fell into the hands of Joseph Davenport, a practical
printer who associated with him James L. Enos, well known and well
remembered by the earlier settlers, who changed the name of the
paper and re-christened it the Cedar Valley Times. Later it was
changed to the Cedar Rapids Times, and was, after changing hands
many times, finally owned by Dr. McClelland and L. M. Ayers, who
published it for years, when it finally died of old age, owned and
published by Dr. McClelland. The old Progressive Era was the original
progenitor of your present Daily Times."
Full of interest are those old files of the Times which deal with the
beginning of the war period in the history of Linn county. There is
the description of a "democratic field day" in Cedar Rapids, October
10, 1860, when Stephen A. Douglas came over from Iowa City and
spoke to the multitude. Bands came from Vinton and Mt. Vernon;
drum corps from Bertram and Cedar Rapids. A local merchant
bought a barrel of good whiskey, diluted it sufficiently to
accommodate the capacity of the six thousand who made up the
audience, sold all of it and counted the meeting as the best thing
which ever had happened in Cedar Rapids. There was a parade of
the "Wide-awakes" that night, and the visiting bands remained over
to furnish a part of the inspiration. There were big posters,
beginning with the couplet

"O, dinna ye hear the slogan, boys?


'Tis Douglas and his men."

That gave the editor of the Times an opportunity to write the first
scare head which ever appeared in a Cedar Rapids newspaper. With
the true newspaper instinct he remembered that slogan and used it
for a sting at the end of the headline. This was the headline the
week of the election:
"ELECTION OVER

ABRAHAM LINCOLN IS PRESIDENT-ELECT

Shout the Glad Tidings, Exultingly Sing; Old Abe is Elected and
Cotton Ain't King—Secession Rebuked—Popular Sovereignty Now
Here—Fusion Worse Confounded—The Bell Tolling for the Dead—
Union Preserved—Dinna Ye Hear the Slogan."
Mr. C. M. Hollis, who was editor of the Cedar Valley Times from 1862
to 1866, gives an illuminating insight into the history of Linn county
during the early days of the war:
"My office in Cedar Rapids was naturally the meeting place of
politicians. There the men who controlled or sought to control got
together and talked plainly. And the plain talk of politicians is very
different from the phrasings which they use in public speeches. It
was thus that our Linn county leaders reasoned. 'This war is
becoming something in which the whole people have intense
interest. They will judge of men from the fact of participation or
opposition. When the struggle is over the men who control in politics
will be those who have been soldiers.' And so these men went after
commissions. They were wise and far-seeing and reaped reward of
their prudence as well as of their valor. I saw the commission of one
Linn county man made out for the majoralty in an Iowa regiment,
not only before the regiment had been organized, but even before a
single company had been raised. I saw another for a colonelcy, fixed
out ahead in the same way, by reason of political grace and pull. Not
but what these men, and others, made good officers. I am only
explaining the reasoning which prompted some of them to enter
service, and the means which were most efficacious in securing
prominent places.
"And after a time it was considered that to get a high commission
was tantamount to drawing a big political prize. Men were thus
rewarded for their assistance given to successful candidates, and
opponents found their way to army prominence beset with many
obstacles. You know that a movement was started in Linn county to
defeat Kirkwood for governor for the second term. This developed
considerable strength, and a ticket was nominated with William H.
Merritt of Cedar Rapids at its head. Merritt had been lieutenant-
colonel of the First Iowa, and his was known as the 'fusion' ticket. It
was an attempt to combine 'war democrats' and some elements of
the republican party. Kirkwood was successful, and those men who
had sought his defeat were, naturally, persona non grata with the
state government. When commissions were going they were not
remembered. Seymour D. Carpenter was one of these. But he did
finally become surgeon of a regiment, because there was crying
need for surgeons. Then when he was away from gubernatorial
influence promotion was rapid, and the doctor was given a position
as medical director of a department. Ellsworth N. Bates was another
who suffered because of participation in the anti-Kirkwood
movement. Mr. Bates persisted, however, and his merits and
standing could not be ignored. He was elected captain of a company.
With his regiment he served with more than usual credit, until he
sickened and came home to die. There were others in Cedar Rapids
and in Linn county who had similar experiences. Some of those who
are still living, if they would but give full statements, would verify my
remark that the proportion of politics mixed with the patriotism of
those times was greater than is generally known.
"Speaking of Ellsworth N. Bates recalls to mind one whose name
deserves to be remembered in Cedar Rapids and in Linn county. He
came to the town fresh from college. He was a real scholar and a
man of rare natural abilities. He had the art of making friends—of
gaining and retaining esteem of all who knew him. He was one of
the very best public speakers I have ever heard—quick to respond to
varying occasion, with ready thought and a phenomenal command
of language. His choice of words and use of appropriate imagery
made his addresses models of their kind. As a lawyer he met with
instant success. He represented Linn county in the legislature, and
was acknowledged as a strong man among the law-makers. He
made a splendid fight for the state senatorship candidacy, against H.
G. Angle. He was assistant secretary of the second constitutional
convention of Iowa. When the war broke out he was one of those
who did much to rouse sentiment for support of the government.
Then he raised Company A of the Twentieth, and proved himself a
real soldier in camp and field. When he came home, near to death,
he had lost none of his old enthusiasm. He and I were intimate
friends, and to me he told his plans for the future. Had E. N. Bates
lived, I know that he would have ranked among the real statesmen
of Iowa. As it was he accomplished more and had greater influence
upon contemporaneous affairs than many whose deeds are very
carefully preserved."
Mr. Hollis also tells us how newspapers were made in that awful
period of the nation's history:
"We were not sensationalists in those days. The events that we had
to chronicle needed no trickery of headlines or large type to
command attention. Here are the lists of dead and wounded in an
Iowa regiment at the battle of Winchester," and the old editor
opened a file of the Times for 1864-65. "Do you think it needed a
flaming poster effect to secure reading of that column? There are
the names of friends and neighbors. To some of the readers of that
paper those names represented their dearest ones. Those who had
brothers or fathers, or sons or sweethearts in that regiment read
over the battle lists with a fearful anxiety. We were giving weekly
chronicle of facts—they have not yet been arranged into the order of
definite history. When we wrote editorials it was not pretended that
we understood all there was to the struggle. Only when and where
we caught the partial views or grasped the immediate meaning of
some development we gave our opinions. These may have been
prejudiced by our personal sentiments or our political affiliations, but
I believe, as a rule, the editorial utterances of those years were from
the souls of the writers and had the ring of sincerity. And, with but
few exceptions, the newspapers of Iowa were loyal. They directed or
seconded loyal sentiment on all occasions. Few of the editors of
those weeklies gained wealth or distinction, but they deserve to be
remembered for a splendid work. They, too, are among 'the
forgotten worthies.' It cost money to run even a weekly paper during
the war years. When I began as publisher of the Times print paper
cost $6 a bundle; before the war was over I was paying $16 for the
same quality and amount. And wages ran up and up, as printers
were more difficult to secure; until I was paying double what I had
first found necessary."
At the close of the war the newspapers of the county began to turn
their attention to other evils. A wave of temperance sentiment swept
the county, and some of the editors were foremost among the
fighters. The county was aroused by the great amount of crime.
Much of it emanated from Cedar Rapids. "Can we expect," asked
one writer in Cedar Rapids, "peace and quiet in a place of 3,000
inhabitants which supports not fewer than nineteen liquor
establishments and several houses of ill fame and does not support
a single reading room nor a public library?"
ALEXANDER LAURANCE
Long Prominent in Cedar Rapids

Then, as now, the newspapers were the best "boosters" of their


respective communities. They were the first to point out the
advantages in each community and to suggest ways in which natural
advantages might lead to commercial growth and civic prosperity.
Thus a writer in a Cedar Rapids paper, after enumerating and
commending the progress made by the town since its organization,
dwelt upon the value of the water power, pointed out how the
woolen mills then in operation might be made more effective. There
was an abundance of timber around Cedar Rapids at that time and
he advocated the establishment of saw mills in the city. He saw no
reason why staves should be brought all the way from Michigan to
Cedar Rapids, when they might as well be manufactured here at
home. He advocated that a packing house be established in this city,
instead of shipping the hogs from Cedar Rapids to Chicago and then
shipping the meat back. "This is only one item that would keep
thousands of dollars in our town that now go out," he argued. He
wanted a hub and a spoke factory, a fanning mill factory, and as for
a "paper mill there is no better point in the state."
History moves in ever repeating cycles and some of the things for
which this old editor fought are still needed today in Cedar Rapids
and in other towns of Linn county. But each cycle is better than the
last. Proof of this is seen in the dispute which was waged over
freight rates less than a decade after the Chicago, Iowa & Nebraska
Railway had been built into this city. The grain rates from Cedar
Rapids to Chicago were thirty cents a hundred pounds and the noise
of protest which was made then was quite similar to the noise which
is sometimes

THE NEWSPAPER GRAVEYARD


The newspaper graveyard was established very early in the history
of the county and it is still claiming its victims. Among its early
victims was the Cedar Rapids Democrat. It was issued by W. W.
Perkins & Co. Somehow or other, democracy never flourished greatly
in the Linn county newspaper field, and the early democratic editors
had not learned the art of switching to a "progressive" side. So their
papers died. The Democrat lived a year and a half. It deserved a
better fate, for it was well edited and printed.
In 1853 a monthly agricultural paper called the Cedar Valley Farmer
was commenced by James L. Enos. It lived through the first volume,
but a grave was opened for it before it had reached the tender age
of two years.
The Voice of Iowa was commenced in January, 1857, under the
auspices of the Iowa Teachers and Phonetic associations, James L.
Enos editor-in-chief, assisted by a board of corresponding editors. It
was continued through two volumes and was then merged with
another journal.
In the autumn of 1864 A. G. Lucas & Co. commenced the publication
of the Cedar Rapids Atlas. In January, 1865, it was changed to a
weekly. Then it was enlarged. Its place in the newspaper graveyard
was prepared a few weeks later. The editor and publisher had gone
to study the geography of other fields, but he did not take his debts
with him. The office was sold to satisfy them. This so weakened the
shoulders of the Atlas that it was not strong enough to hold up.
The Western World was born into a cold and unresponsive world,
and soon it joined the ranks of the dear departed.
Then came the Linn County Signal which its authors hoped would be
a signal success. But its signals became tangled and it failed to kick
over the goal of success. It kicked the bucket instead. T. G.
Newman, the father of A. H. Newman of the Cedar Rapids Candy
Company, purchased the remains. From them he made the office of
the Daily Observer, with J. L. Enos as editor. From the Observer
came the Cedar Rapids Republican. This was in 1870. In 1902 there
was re-born the Cedar Rapids Times. The father Republican and the
strong and lusty son Times are both in the full vigor of their powers,
and this evolution of the two powerful dailies from the amoeba-like
weakly Signal is the most conspicuous example of newspaper
evolution and the survival of the fittest on record.
The present Cedar Rapids Times is not to be confounded with the
Cedar Rapids Weekly Times which had such a long and prosperous
growth under the management of Editor Hollis, and later of the good
Doctor McClelland. The Weekly Times lived until the death of Doctor
McClelland, and it was a power for good. Then came two gentlemen
from Milwaukee who converted it into a daily. They had a great run
as long as their cash and their credit held out. And they were good
newspaper men, too. But they drew nearer and nearer the gateway
to the great and yawning newspaper graveyard. There were many
mourners in Cedar Rapids when the Times was buried. It had been
purified before its death by its conspicuous work in a great tent
revival conducted by an evangelist, M. B. Williams. This revival the
other dailies refused even to mention. The Times had a great deal of
broadcloth endorsement. But the eulogies proved to be its
premature obituaries. Cash came slowly. Advertising was coy. With
the fall of the leaves came the death of the Times. The Gazette
bought up the household furnishings, the subscription lists and the
good will. But the Times was buried, and the ghost of competition
which had haunted the Gazette office was laid until the owners of
the present Evening Times resurrected the name amid a riot of red
ink during the strenuous municipal campaign of 1902.

STANDARD HAD A LONG LIFE


The Cedar Rapids Standard, like the Cedar Valley Times, had a long
life. It was first established in Marion in 1868, as the Linn County
Signal, by F. H. Williams. The following year it was removed to Cedar
Rapids, and Thomas G. Newman became the owner. In 1872 the
name was changed to the Linn County Liberal, and the office was
moved back to Marion. In 1873 James T. Simpkins became editor.
The following year the plant made a final trip to Cedar Rapids and
was changed to the Standard. For a long time it flourished, having a
number of owners and editors. Among them were Thomas G.
Newman, C. E. Heath, A. H. Newman, D. H. Ogden, H. A. Cook,
Frank L. Millar, and in June, 1880, Charles H. Playter, of the Des
Moines Daily Leader, came to town and bought a half interest of Mr.
Millar. The firm name became Millar & Playter. This partnership
continued until the fall of 1885, when Mr. Playter bought out his
partner and became the sole owner. In the fall of 1886 Mr. Playter
sold the Standard to S. B. Ayers, who conducted it through the
triumphal period of Iowa democracy, when Horace Boies sat in the
gubernatorial chair. It was a strong democratic paper and had a
large patronage in Linn county at that time. Later L. S. Saner
became the editor. But the hard times came. Rightly or wrongly they
were blamed on the democratic party. Republicanism triumphed;
McKinley was elected. The Standard of the democratic party was
trailed in the dust. It soon died and took its place in the Cedar
Rapids journalistic graveyard.
The Marion Pilot was established in 1871 at Mt. Vernon, as the Linn
County Pilot, and C. W. Kepler was editor. In 1874 the office was
removed to Marion and the paper was owned by Beatty & Whittits. It
continued under this management for several years and was one of
the strong republican papers of the county. In 1884 it was purchased
by the Rev. J. W. Chaffee and its name was changed to the Marion
Pilot. He built up a good paper, putting it in the front rank of the
weekly papers of the state. But with his passing from the editorial
chair and the rapid rise of the daily press in Cedar Rapids and its
rival county seat newspapers its power and prestige waned. In 1906
it yielded up the ghost and was assigned to an honored place among
those that have passed on.

The Good Ones Which Remain


THE DAILY REPUBLICAN AND THE EVENING TIMES

As narrated above, the Daily Republican is the outgrowth of the daily


Observer. In 1872 the Observer was transferred to the Republican
Printing Company, and the name, which at first was the Cedar
Rapids Republican, was changed to the Daily Republican, the present
name of the paper.
A daily and weekly issue was published and the paper grew rapidly.
For a time it was edited by William B. Leach. In 1877 it passed into
the hands of the Republican Printing Company, who put in a great
amount of capital and enlarged the office. There were many editors
during this period. In March, 1881, the office was leased to J. R.
Sage and D. G. Goodrich, with an option of sale within a year. During
this period the paper was changed from an evening to a morning
issue and an Associated Press franchise was secured, giving the
paper full news service.
Before the lease had expired Messrs. Sage and Goodrich had
exercised their right to purchase the plant. On March 1, 1882, it was
transferred to J. R. Sage, Johnson Brigham, Fred Benzinger, and H.
P. Keyes. This quartette reorganized the old Republican Printing
Company, with J. R. Sage as president. Nearly two years later Mr.
Sage transferred his interest to Mr. Brigham, and later on Messrs.
Keyes and Benzinger transferred their interest to L. S. Merchant.
Messrs. Brigham and Merchant conducted the paper, Mr. Merchant as
business manager and Mr. Brigham as editor, until 1892, when Mr.
Brigham sold his interest and went to Des Moines to start the first
Iowa literary magazine, the Midland Monthly. Mr. Sage had
previously gone to Des Moines to become the director of the Iowa
weather and crop service.
Mr. Brigham's interest was purchased by Luther A. Brewer, who had
been assistant business manager, W. R. Boyd, who had done some
editorial work for the paper while living at home in Cedar county,
and by L. S. Merchant. The paper was at the beginning of what
seemed to be an uninterrupted period of ownership and prosperity
when death suddenly claimed Mr. Merchant in 1894. Mrs. Merchant
retained her husband's interest and the paper went on as before and
waged a fight against free silver in the campaign of 1896 which
made it nationally prominent. Mr. Brewer in the meantime had built
up a very large job printing and book binding department.
In 1898 the entire plant was sold to H. G. McMillan, of Rock Rapids,
at that time United States district attorney, and Cyrenus Cole, who
had for many years been associate editor of the Iowa State Register.
Mr. Boyd became postmaster at Cedar Rapids, but Mr. Brewer
remained with the paper as its business manager for some time. An
evening edition, the Evening Times, was started in 1902, and made
a rapid growth. It now has the largest circulation of any daily paper
in Cedar Rapids.
In 1907 Mr. Brewer left the business and opened up a big book-
making plant of his own known as The Torch Press. In July of the
same year however, The Torch Press bought out the interest of Mr.
McMillan and the Daily Republican and the Evening Times have since
been owned and published by Messrs. Brewer and Cole. The
substantial building on Second avenue which had been erected
during the regime of Messrs. Brigham and Merchant proved far too
small and the property was sold. A large and modern newspaper and
book-making building, four stories high, was erected at the corner of
Fourth avenue and Third street, the present home of the Daily
Republican, the Evening Times, The Torch Press Printery and
Bindery, and The Torch Press Book-shop, which latter is managed by
William Harvey Miner and is the biggest and most largely patronized
book shop west of Chicago.

THE EVENING GAZETTE

There is not a great deal of "history" concerning the Cedar Rapids


Evening Gazette, which has been one of the conspicuous successes
among Iowa daily newspapers since it was started in 1883. On June
10 of that year, the daily Gazette was founded by Messrs. Otis and
Post. A weekly issue of the paper was started at the same time. In
March, 1884, the Gazette Company was organized, and in July of
that year the entire stock was purchased by Messrs. Fred W. Faulkes
and Clarence L. Miller. The paper has had the same ownership ever
since that time. The late editor Faulkes was a pungent and versatile
writer, and under his editorial management the Gazette rapidly rose
to a commanding position in the Iowa newspaper field. It began as a
republican newspaper. But after the memorable Frank D. Jackson
campaign in 1893 Editor Faulkes became estranged from Governor
Jackson and some of the other leaders of the republican party.
Thereafter he was inclined to espouse the cause of democracy and
the Gazette came to be regarded as the democratic newspaper of
Linn county. Still later it grew more independent, in matters of
politics.
Since the death of Fred Faulkes the Gazette has been published
under the supervision of its business manager Clarence L. Miller. Like
the other dailies of the city it has abandoned the weekly field.

THE SATURDAY RECORD

The Saturday Record is the outgrowth of a little amateur paper


started away back in 1879 by Ralph Van Vechten, at present vice-
president of the Continental and Commercial National Bank of
Chicago. He was then a student with a taste for printer's ink and he
started a little literary paper, known as the Stylus. Soon after that he
was joined by Arthur J. Huss, and the two of them ran the Stylus. In
the spring of 1882 Mr. Van Vechten went into his uncle's bank. The
paper passed into the hands of A. J. Mallahan, and after a little time
was temporarily discontinued. But Mr. Huss gained new courage and
perhaps new capital. September 10, 1882, he started the Cedar
Rapids People. It continued as a seven column folio until March,
1884, when it was bought by Fred Benzinger and R. Baer and its
name changed to the Saturday Evening Chat. July 1, 1887, Fred
Benzinger bought out Mr. Baer's interest and ran the paper for a
number of years until he went to Chicago, where for a time he was
one of the prominent figures on the old Chicago Times-Herald. Then
the paper was acquired by B. R. Hatmaker, forever famous because
of the sobriquet for Cedar Rapids which flashed into his mind one
dreamful day—"The Parlor City."
In 1889 Ernest A. Sherman came to this city and was city editor of
the morning Republican for a while. In February. 1891, he started
Town Topics. He ran it until late in the spring of that year and then
he consolidated with Hatmaker's Saturday Record. He became the
editor, and Hatmaker was business manager until 1892 when Mr.
Sherman bought the whole business. Since that time the Record has
been a permanent feature in Cedar Rapids, the largest and neatest
of the weeklies, being printed in quarto form on book paper with
many illustrations and spicy comment on "mentionable matters" of
Cedar Rapids, with all the local news well edited.
THE IOWA POST

The Iowa Post was founded in April, 1881, at Iowa City. After
passing through the hands of several owners, it was purchased in
March, 1902, by Henry Gundling of Chicago and brought to this city.
Mr. Gundling changed the paper from a weekly to a semi-weekly and
in an incredibly short time he had trebled the number of his
subscribers. Mr. Gundling had a high school education in Germany,
followed by an apprenticeship there of three years. He had sixteen
years experience in Chicago and he has travelled extensively on
three continents. He is, therefore, thoroughly equipped as an editor
and this accounts for the high standard of his paper which is eagerly
read by a very large constituency in this and adjoining counties and
especially at the colony of Amana.

OLD M. E. CHURCH, MT. VERNON


Welcome to our website – the ideal destination for book lovers and
knowledge seekers. With a mission to inspire endlessly, we offer a
vast collection of books, ranging from classic literary works to
specialized publications, self-development books, and children's
literature. Each book is a new journey of discovery, expanding
knowledge and enriching the soul of the reade

Our website is not just a platform for buying books, but a bridge
connecting readers to the timeless values of culture and wisdom. With
an elegant, user-friendly interface and an intelligent search system,
we are committed to providing a quick and convenient shopping
experience. Additionally, our special promotions and home delivery
services ensure that you save time and fully enjoy the joy of reading.

Let us accompany you on the journey of exploring knowledge and


personal growth!

ebookname.com

You might also like