Building Java Programs: A Back to Basics Approach Stuart Reges pdf download
Building Java Programs: A Back to Basics Approach Stuart Reges pdf download
https://textbookfull.com/product/building-java-programs-a-back-
to-basics-approach-stuart-reges/
https://textbookfull.com/product/building-java-programs-a-back-
to-basics-approach-stuart-reges-2/
https://textbookfull.com/product/building-java-programs-a-back-
to-basics-approach-5th-edition-stuart-reges/
https://textbookfull.com/product/building-python-programs-1st-
edition-stuart-reges/
https://textbookfull.com/product/simpler-living-back-to-basics-
guides-2nd-edition-jeff-davidson/
College physics : a strategic approach 4th Edition
Stuart Field
https://textbookfull.com/product/college-physics-a-strategic-
approach-4th-edition-stuart-field/
https://textbookfull.com/product/artificial-intelligence-a-
modern-approach-4th-edition-stuart-russell/
https://textbookfull.com/product/restful-java-web-services-a-
pragmatic-guide-to-designing-and-building-restful-apis-using-
java-3rd-edition-balachandar/
https://textbookfull.com/product/a-functional-approach-to-java-
augmenting-object-oriented-java-code-with-functional-
principles-1st-edition-ben-weidig/
https://textbookfull.com/product/back-trouble-a-new-approach-to-
prevention-and-recovery-based-on-the-alexander-technique-deborah-
caplan/
Building Java Programs
A Back to Basics Approach
Fourth Edition
Stuart Reges
University of Washington
Marty Stepp
Stanford University
The authors and publisher of this book have used their best efforts in
preparing this book. These efforts include the development, research, and
testing of the theories and programs to determine their effectiveness. The
authors and publisher make no warranty of any kind, expressed or implied,
with regard to these programs or to the documentation contained in this book.
The authors and publisher shall not be liable in any event for incidental or
consequential damages in connection with, or arising out of, the furnishing,
performance, or use of these programs.
Copyright © 2017, 2014 and 2011 Pearson Education, Inc. or its affiliates.
All rights reserved. Printed in the United States of America. This publication
is protected by copyright, and permission should be obtained from the
publisher prior to any prohibited reproduction, storage in a retrieval system,
or transmission in any form or by any means, electronic, mechanical,
photocopying, recording, or otherwise. For information regarding
permissions, request forms and the appropriate contacts within the Pearson
Education Global Rights & Permissions department, please visit
www.pearsonhighed.com/permissions/.
10 9 8 7 6 5 4 3 2 1
Introductory computer science courses are often seen as “killer” courses with
high failure rates. But as Douglas Adams says in The Hitchhiker's Guide to
the Galaxy, “Don't panic.” Students can master this material if they can learn
it gradually. Our textbook uses a layered approach to introduce new syntax
and concepts over multiple chapters.
Here are some of the changes that we have made in the fourth edition:
Since the publication of our third edition, Java 8 has been released. This new
version supports a style of programming known as functional programming
that is gaining in popularity because of its ability to simply express complex
algorithms that are more easily executed in parallel on machines with
multiple processors. ACM and IEEE have released new guidelines for
undergraduate computer science curricula, including a strong
recommendation to cover functional programming concepts.
We have added a new Chapter 19 that covers most of the functional concepts
from the new curriculum guidelines. The focus is on concepts, not on
language features. As a result, it provides an introduction to several new Java
8 constructs but not a comprehensive coverage of all new language features.
This provides flexibility to instructors since functional programming features
can be covered as an advanced independent topic, incorporated along the
way, or skipped entirely. Instructors can choose to start covering functional
constructs along with traditional constructs as early as Chapter 6. See the
dependency chart at the end of this section.
Case studies. We end most chapters with a significant case study that
shows students how to develop a complex program in stages and how to
test it as it is being developed. This structure allows us to demonstrate
each new programming construct in a rich context that can't be achieved
with short code examples. Several of the case studies were expanded
and improved in the second edition.
The following table shows how the layered approach works in the first six
chapters:
Control Programming
Chapter Data Input/Output
Flow Techniques
procedural
1 methods String literals println, print
decomposition
definite variables, local variables, class
2 loops expressions, constants,
(for) int, double pseudocode
console input, 2D
return
3 using objects parameters graphics
values
(optional)
conditional char pre/post conditions, printf
4
(if/else) throwing exceptions
indefinite
assertions, robust
5 loops boolean
programs
(while)
token/line-based file
6 Scanner file I/O
processing
Answers to all self-check problems appear on our web site and are accessible
to anyone. Our web site has the following additional resources for students:
Source code and data files for all case studies and other complete
program examples
Our web site has the following additional resources for teachers:
Closed lab creation tools to produce lab handouts with the instructor's
choice of problems integrated with the textbook
MyProgrammingLab
MyProgrammingLab is an online practice and assessment tool that helps
students fully grasp the logic, semantics, and syntax of programming.
Through practice exercises and immediate, personalized feedback,
MyProgrammingLab improves the programming competence of beginning
students who often struggle with basic concepts and paradigms of popular
high-level programming languages. A self-study and homework tool, the
MyProgrammingLab course consists of hundreds of small practice exercises
organized around the structure of this textbook. For students, the system
automatically detects errors in the logic and syntax of code submissions and
offers targeted hints that enable students to figure out what went wrong, and
why. For instructors, a comprehensive grade book tracks correct and
incorrect answers and stores the code inputted by students for review.
VideoNotes
Roughly 3–4 videos are posted for each chapter. An icon in the margin of the
page indicates when a VideoNote is available for a given topic. In each video,
we spend 5–15 minutes walking through a particular concept or problem,
talking about the challenges and methods necessary to solve it. These videos
make a good supplement to the instruction given in lecture classes and in the
textbook. Your new copy of the textbook has an access code that will allow
you to view the videos.
Acknowledgments
First, we would like to thank the many colleagues, students, and teaching
assistants who have used and commented on early drafts of this text. We
could not have written this book without their input. Special thanks go to
Hélène Martin, who pored over early versions of our first edition chapters to
find errors and to identify rough patches that needed work. We would also
like to thank instructor Benson Limketkai for spending many hours
performing a technical proofread of the second edition.
Second, we would like to thank the talented pool of reviewers who guided us
in the process of creating this textbook:
Finally, we would like to thank the great staff at Pearson who helped produce
the book. Michelle Brown, Jeff Holcomb, Maurene Goo, Patty Mahtani,
Nancy Kotary, and Kathleen Kenny did great work preparing the first edition.
Our copy editors and the staff of Aptara Corp, including Heather Sisan, Brian
Baker, Brendan Short, and Rachel Head, caught many errors and improved
the quality of the writing. Marilyn Lloyd and Chelsea Bell served well as
project manager and editorial assistant respectively on prior editions. For
their help with the third edition we would like to thank Kayla Smith-Tarbox,
Production Project Manager, and Jenah Blitz-Stoehr, Computer Science
Editorial Assistant. Mohinder Singh and the staff at Aptara, Inc., were also
very helpful in the final production of the third edition. For their great work
on production of the fourth edition, we thank Louise Capulli and the staff of
Lakeside Editorial Services, along with Carole Snyder at Pearson. Special
thanks go to our lead editor at Pearson, Matt Goldstein, who has believed in
the concept of our book from day one. We couldn't have finished this job
without all of their hard work and support.
Stuart Reges
Marty Stepp
Break through
To Improving results
MyProgammingLab™
Through the power of practice and immediate personalized feedback,
MyProgrammingLab helps improve your students' performance.
Programming Practice
With MyProgrammingLab, your students will gain firs-hand programming
experience in an interactive online environment.
Graduated Complexity
MyProgrammingLab breaks down programming concepts into short,
understandable sequences of exercises. Within each sequence the level and
sophistication of the exercises increase gradually but steadily.
Dynamic Roster
Students' submissions are stored in a roster that indicates whether the
submission is correct, how many attempts were made, and the actual code
submissions from each attempt.
Pearson eText
The Pearson eText gives students access to their textbook anytime, anywhere
www.pearsonhighered.com/cs-resources
1. Why Programming? 2
5. Why Java? 7
2. System.out.println 15
3. Escape Sequences 15
1. Syntax Errors 24
2. Logic Errors (Bugs) 28
1. Static Methods 31
2. Flow of Control 34
1. Structured Version 41
1. Primitive Types 64
2. Expressions 65
3. Literals 67
4. Arithmetic Operators 68
5. Precedence 70
2. 2.2 Variables 74
1. Assignment/Declaration Variations 79
2. String Concatenation 82
3. Increment/Decrement Operators 84
1. Scope 99
2. Pseudocode 105
1. DrawingPanel 197
3. Colors 203
4. System.out.printf 269
3. Simulations 324
20 "Among the Dutch settlers the art of stone-cutting does not appear
to have been used until within comparatively a few years, with but few
exceptions, and their old burying-grounds are strewn with rough head-
stones which bear no inscriptions; whereas the English people,
immediately on their settlement, introduced the practice of perpetuating
the memories of their friends by inscribed stones. Another reason for not
finding any very old tombstones in the Dutch settlements is that they
early adopted the practice of having family burying-places on their farms,
without monuments, and not unfrequently private burials, both of which
the Governor and Colonial Legislature, in 1664 and 1684, deemed of
sufficient importance to merit legislative interference, and declared that all
persons should be publicly buried in some parish burial-place."—Furman,
Antiquities of Long Island, p. 155.
21 New York, p. 29.
28 The river farm, which included the "Kiekout" bluff, is first found in
the possession of Jean Meserole, who came from Picardy, France, in 1663,
and from whom is descended Gen. Jeremiah V. Meserole, President of the
Williamsburgh Savings Bank, first colonel of the Forty-seventh Regiment,
N. G. S. N. Y.
29 So named from Dirck Volckertsen, surnamed "the Norman," to
whom was granted in 1645 land on the East River between Bushwick
Creek and Newtown Creek, now within the seventeenth ward of the city
of Brooklyn, and still known as Greenpoint. Volckertsen lived in a stone
house on the northerly side of Bushwick Creek near the East River. The
house was standing until after the middle of the present century.
30 Early section names within the township of Breuckelen were
Gowanus, Red Hook (lying west of the Ferry), the Ferry, Wallabout,
Bedford, Cripplebush. All of these, save the last, have survived as
designations of regions in the present city.
31 When, in 1660, it was deemed necessary to prepare defenses for
Breuckelen and New Utrecht against attacks from the Indians, De Sille
was directed to make the necessary surveys. Under Stuyvesant De Sille
held the important position of attorney-general. He was a man of ability
and influence. The position he held under Stuyvesant demonstrated the
fact that his attainments were appreciated. He was born in Arnheim. His
ancestors were natives of Belgium, who fled to Holland to escape religious
persecution, and whose devotion to the interests of their adopted country
was manifested on many occasions in the noble stand taken by the Dutch
Republic to maintain its independence against the Spanish invasion. He
came to New Netherland in 1653, commissioned by the West India
Company to reside at New Amsterdam, and by his counsel aid and assist
the Governor in his duties. He was directed to give his advice on all
subjects relating to the interests of the colony. It is said that he built the
first house in New Utrecht. It was at his house that the brave General
Woodhull, the hero of Long Island, who gave his life for his country,
breathed his last.—S. M. O.
32 Journal of a Voyage to New York and a Tour in Several of the
American Colonies in 1679-80. By Jasper Dankers and Peter Sluyter of
Wiewerd, in Friesland. Translated from the original manuscript in Dutch
for the Long Island Historical Society, and edited by Henry C. Murphy,
Foreign Corresponding Secretary of the Society. Brooklyn, 1867.
33 "No man has been more maligned or misunderstood than Jacob
Leisler. Historians have deliberately misjudged him, drawing their
conclusions from the biased reports of the few aristocrats who hated or
the English officials who despised him. Jacob Leisler was one of the
earliest of American patriots. His brief and stormy career as Provincial
Governor of New York was marked by mistakes of judgment, but his
mistakes were more than overbalanced by his foresight and
statesmanship. He acted as one of the people for the people. He
summoned a popular convention, arranged the first mayoralty election by
the people, attempted the first step toward colonial union by endeavoring
to interest the several provinces in a continental congress, and sought to
cripple the chief adversary of the English in America, France, by the
masterly stroke of an invasion of Canada. That he failed is due to the
jealousy, the timidity, and the short-sightedness of his fellow colonists. But
he builded wiser than he knew; for, though he died a martyr to colonial
jealousy and English injustice, his bold and patriotic measures awoke the
people to a knowledge of their real power, and prepared them for that
spirit of resistance to tyranny which a century later made them a free
republic."—Elbridge S. Brooks, The Story of New York, p. 74.
34 "The government of the colony was at once put on the basis on
which it stood until the outbreak of the Revolution. There was a governor
appointed by the king, and a council likewise appointed; while the
assembly was elected by the freeholders. The suffrage was thus limited
by a strict property qualification. Liberty of conscience was granted to all
Protestant sects, but not to Catholics; and the Church of England was
practically made the state church, though the Dutch and French
congregations were secured in the rights guaranteed them by treaty. It
was, then, essentially a class or aristocratic government,—none the less
so because to European eyes the little American colony seemed both poor
and rude."—Theodore Roosevelt, New York, p. 71.
35 There are varying views of Kidd's character and career. Thus
Berthold Fernow writes in the Narrative and Critical History of America
(vol. v. p. 195): "To-day that which was meted out to Kidd might hardly
be called justice; for it seems questionable if he had ever been guilty of
piracy."
36 The assessment rolls of the five Dutch towns in 1675 showed the
following proportions in the number of persons assessed: Breuckelen, 60;
Midwout, 54; Boswyck (Bushwick) 36; Amersfoort, 35; New Utrecht, 29.
37 The peculiar methods employed by the citizens of Brooklyn at that
time in electing their officials cannot be better illustrated than by the
presentation of a report of one of those town meetings as follows:—
47 The wife of John Rapalje was a well-known Tory. So far did she
manifest her predilections in favor of the Tory cause as at all times to
boldly proclaim her sympathies for the King. At the time the act was
passed prohibiting the use of tea, she, with her proverbial pertinacity and
obstinacy, persisted in its use, and so continued while the American army
was in the occupation of Brooklyn. On this account she became a marked
woman. Her conduct caused much discussion, and drew down upon her
the umbrage of the Whig militia, who fired a cannon ball into her home
while she was drinking her favorite beverage. The ball passed close to her
head and lodged in the wall. This action not only seriously annoyed the
lady, but served to stir within her bosom the spirit of revenge, and she
eagerly awaited an opportunity to gratify her spite. When she saw the
preparations for the retreat of the army her heart rejoiced, for she fancied
that the moment had arrived when she could mete out punishment to her
enemies.—S. M. O.
48 Force's 5th series, vol. ii. p. 107.
Transcriber's Notes:
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.
textbookfull.com