Programming Logic and Design Comprehensive 6th Edition Joyce Farrell instant download
Programming Logic and Design Comprehensive 6th Edition Joyce Farrell instant download
https://ebookname.com/product/programming-logic-and-design-
comprehensive-6th-edition-joyce-farrell/
https://ebookname.com/product/just-enough-programming-logic-and-
design-1st-edition-joyce-farrell/
https://ebookname.com/product/java-programming-5th-edition-joyce-
farrell/
https://ebookname.com/product/object-oriented-programming-using-
c-fourth-edition-joyce-farrell/
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/
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/
https://ebookname.com/product/the-fine-art-of-success-how-
learning-great-art-can-create-great-business-1st-edition-
reckenrich/
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.
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
Glo s s ar y . . . . . . . . . . . . . . . . 666
In dex . . . . . . . . . . . . . . . . . 681
Preface
xvi
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
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
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
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
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
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.
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.
ebookname.com