Building Java Programs - A Back to Basics Approach 5th Edition Stuart Reges all chapter instant download
Building Java Programs - A Back to Basics Approach 5th Edition Stuart Reges all chapter instant download
https://ebookmass.com
https://ebookmass.com/product/building-java-
programs-a-back-to-basics-approach-5th-edition-
stuart-reges/
https://ebookmass.com/product/building-java-programs-a-back-to-basics-
approach-4th-edition-stuart-reges/
testbankdeal.com
https://ebookmass.com/product/ebook-pdf-building-java-programs-a-back-
to-basics-approach-5th-edition/
testbankdeal.com
https://ebookmass.com/product/java-a-beginners-guide-create-compile-
and-run-java-programs-today-9th-edition-herbert-schildt/
testbankdeal.com
https://ebookmass.com/product/introduction-to-programming-with-java-a-
problem-solving-approach-3rd-edition-john-dean/
testbankdeal.com
College physics : a strategic approach 4th Edition Stuart
Field
https://ebookmass.com/product/college-physics-a-strategic-
approach-4th-edition-stuart-field/
testbankdeal.com
https://ebookmass.com/product/artificial-intelligence-a-modern-
approach-4th-edition-stuart-russell/
testbankdeal.com
https://ebookmass.com/product/how-to-read-a-paper-the-basics-of-
evidence-based-medicine-5th-edition-ebook-pdf/
testbankdeal.com
https://ebookmass.com/product/a-comprehensive-guide-to-sports-
physiology-and-injury-management-an-interdisciplinary-approach-stuart-
porter/
testbankdeal.com
https://ebookmass.com/product/complexity-economics-building-a-new-
approach-to-ancient-economic-history-koenraad-verboven/
testbankdeal.com
Building Java Programs
A Back to Basics Approach
Fifth Edition
Stuart Reges
University of Washington
Marty Stepp
Stanford University
SVP, Courseware Portfolio Management: Marcia Horton
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.
1 19
This year also marks the release of our new Building Python
Programs textbook, which brings our “back to basics” approach to
the Python language. In recent years Python has seen a surge in
popularity in introductory computer science classrooms. We have
found that our materials and approach work as well in Python as
they do in Java, and we are pleased to offer the choice of two
languages to instructors and students.
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:
MyLab Programming
MyLab Programming 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, MyLab Programming 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 MyLab
Programming 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
Visit https://ebookmass.com
now to explore a rich
collection of eBooks and enjoy
exciting offers!
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.
It had been a day thickly veined and marbled with emotions for the
little group of men who, aforetime, had in some measure controlled
the sea-going vagaries of that decrepit old barque, the “Jane
Gladys.” For, that day, the “Jane Gladys” had ceased to be a ship
dowered with an imposing collection of virtues perceptible only to the
auctioneer, and had become but so much old wood and rusting iron
to be exploited by the speculative marine-store dealer who hazarded
the highest price for her unlovely bulk.
This distressful climax in the nautical career of the “Jane Gladys”
was not allowed to go unwitnessed by those who had so long lived
and thrived amid the sinister shadows of her ill-repute as a barque
that was the natural home of venal duplicities. The erstwhile crew of
the “Jane Gladys,” those established confederates in mercenary plot
and counterplot, had rallied to watch the transfer of their stronghold
into alien and unsympathetic ownership, and, in the untroubled
throng about the auctioneer, they stood as figures thrust apart from
their fellow-men by the stern arm of Tragedy.
Captain Peter Dutt was there, his countenance a very show-case of
mournful reminiscence as he gazed upon his late command,
although he had retired ashore on a comfortable pension, and had
already taken to bragging about his extraordinary prowess as an
amateur grower of vegetables. That venerable and corpulent
amphibian, Mr. Samuel Clark, was there, too, having contrived to
evade for a while his present duties as ferryman across Shorehaven
Harbour in order to attend this dismal chapter in the history of the
vessel upon which he had served for so many years. And Mr.
Horace Dobb, who formerly graced the cook’s galley of the doomed
ship, was also in attendance in the great glory of garb which was
explained and justified by the fact that he had married a widow and a
snug second-hand business at one fortunate sweep.
But, as may be inferred, the regrets of Captain Dutt, of Mr. Clark, and
of Mr. Dobb were almost entirely retrospective, for their daily bread
was assured. The future was firm ground for their feet to tread, and
their woeful deportment had therefore merely a sentimental value.
Far more earnest and practical was the grief at the passing of the
“Jane Gladys” of the two remaining members of her old crew, Mr.
Peter Lock and Mr. Joseph Tridge.
Despite the assiduity with which these two gentlemen had of late
pointed out to the great god Luck ways by which he might help them,
that fickle deity had proved himself singularly unresponsive. And this
meant that neither Mr. Lock nor Mr. Tridge had any attractive
prospects to solace them for the loss of their employment on the
“Jane Gladys.”
By personal inquiry they had discovered that no master mariner was
prepared to risk the morale of his crew by importing into the fo’c’sle
anyone who had been even remotely connected with the “Jane
Gladys,” nor was a task ashore obtainable when once they had
mentioned the only references they could give.
True, Mr. Dobb had promised them his favour, but, so far, nothing
had come of it save the abortive attempt to procure employment for
Mr. Tridge as a hairdresser. Not that there was any question as to
Mr. Dobb’s sincerity of purpose, for, in projecting philanthropies for
his two unfortunate shipmates, he was largely considering his own
interests. “Strictly Business!” was the self-chosen motto that
controlled Mr. Dobb’s energies in every direction, and always there
was present in his mind the idea that profitable disposal of stock
from the shop in Fore Street might skilfully be accelerated by the
placing of his old accomplices of the “Jane Gladys” in strategic
situations about the town.
But, apart from securing Mr. Samuel Clark his present job, Mr.
Dobb’s efforts had hitherto been negligible in result, and now, of
those who mourned the end of the “Jane Gladys,” none mourned her
with more genuine feeling or with a greater sense of personal
bereavement than Mr. Lock and Mr. Tridge, for others were only
mourning for memories, while they were mourning a lost home.
Gradually, however, as the day had worn on, they had struggled with
and overcome their melancholy, mounting, indeed in the end to a
flippant hilarity which fitted but incongruously with the gravity of their
prospects.
But this was not till the day was nearing its close. The early
afternoon had been a space of sighs and doleful head-shakings, for,
at the close of the sale, Captain Dutt had led his old subordinates
into the “Turk’s Head,” and here they had all spoken so wistfully and
reverently about the “Jane Gladys” that the landlady had wondered
how one of them could have come back wearing a green and pink tie
from a funeral.
Mr. Horace Dobb, not averse from exhibiting the opulence of his new
sphere in life to his former skipper, competed with that worthy for the
honour of being prime host to the party. It was a challenge which
Captain Dutt’s pride forbade him to refuse, and so round after round
of refreshment was served, till by degrees a brisker mood
descended upon the company.
It was not till past tea-time that the party had begun to break up. Mr.
Clark was the first to leave, having suddenly remembered that he
had faithfully promised to return to the ferry at one o’clock sharp.
And next Mr. Dobb went, pleading the calls of business, and
purchasing a cigar at the bar as he left, with excellent effect. For
Captain Dutt, after silently and disapprovingly considering such an
action on an ex-cook’s part, at last stigmatized it as a kind of
Socialism, and bought Mr. Lock and Mr. Tridge a cigar apiece to re-
establish his prestige.
Soon after, Captain Dutt reluctantly announced that he, too, must
now depart, and Messrs. Tridge and Lock accompanied him to the
nearest draper’s shop, where he sagely selected a bonnet to be
presented to Mrs. Dutt the moment he got home. And when the
skipper, already holding the hat-box before him in a propitiatory
manner, had passed from their sight round a corner, Mr. Tridge and
Mr. Lock looked hard and remindedly at each other, and then made
search in their pockets.
As a result, the one party produced a shilling and five pennies, and
the other party disclosed a florin and a halfpenny; frank and
unabashed confession admitted these coins to be “change” which
the skipper had forgotten to pick up amid the mental distractions of
the afternoon.
Whereupon, congratulating themselves and each other on this
presence of mind in face of opportunity, Mr. Lock and Mr. Tridge had
retired to the tap-room of the “Royal William,” and had there
abundantly developed their policy of drowning dull care.
By now the night was well advanced, and a fevered, reckless
brilliance was illuminating Mr. Lock’s personality, lighting up all those
manifold polite accomplishments of which he was a master. Thus,
he had entertained the company with a series of imitations of bird-
calls, and performed clever feats of legerdemain with corks and
pennies and hats.
Mr. Tridge was in complete eclipse. He had tried hard to be not
ungenial, but his temperament was different from Mr. Lock’s, and
every minute of revelry only found him more and more subdued and
morose. He had struggled against this psychological handicap, even
to the extent of exhibiting to the company four or five styles of
dancing with which he was familiar, but so morose and forbidding
was his countenance as he jigged and gyrated that none dared claim
his attention by offering applause, so that when he sat down again it
was amid complete and discouraging silence.
Mr. Lock, however, shone still more effulgently as the evening
progressed. Knotting his handkerchief into semblance of a doll, he
affected that it was a wife and that he was its husband, and built up
on these premises a highly diverting ventriloquial monologue.
And, after that, he successfully introduced some farmyard mimicry,
and then got well away with card tricks. Appreciative, and even
enthusiastic, were Mr. Lock’s audience, and none was more
enthusiastic or appreciative than the plump, fresh-faced little landlord
of the “Royal William.” Not once, nor twice, but thrice, did he pay
tribute to Mr. Lock’s powers in the medium most gratifying to that
artist, and his flow of hospitality ceased only when a big and stern-
visaged lady came presently and stood behind the bar at his side.
And, thereafter, the licensee of the “Royal William” took, as it were,
but a furtive and subsidiary interest in Mr. Lock’s entertainment;
while the lady eyed the performance with a cold hostility which was
inimical to true art.
And whether it was that Mr. Lock grew a little flustered under her
malign regard, or whether it was that he sought to sting the landlord
into revolt against domestic oppression, the fact remains that he
began to intersperse his card tricks with humorous, but inflammatory,
remarks bearing on the subject of domineering wives and too
submissive husbands.
It is possible that the landlord of the “Royal William” derived
amusement from these sallies. Certainly his eyes gleamed at each
thrust, and more than once he turned away to conceal a grin, but he
was too craven to exhibit open hilarity at Mr. Lock’s satires. The
landlady, however, did not hesitate to betray her feelings in the
matter, and thus it was that, at the tail of an amusing anecdote of
domestic tyranny, Mr. Lock found himself confronted with a stern and
acidulated request to sit down and keep quiet unless he wished to
find himself in trouble.
Mr. Lock, a little nonplussed, glanced at the landlord to enlist his
support. The landlord’s gaze was apologetic but unhelpful. Mr. Lock
looked around among his admirers, but their demeanour had
become absent and constrained. Mr. Lock turned and regarded Mr.
Tridge; Mr. Tridge was wrapped in his own sable meditations.
Pettishly, Mr. Lock flung down the pack of cards and sulked in a
corner.
The landlady, having thus suppressed unwelcome propaganda,
indulged in a tight-lipped smile of triumph, and began a rinsing of
glasses. The hush deepened in the room, developing an
atmosphere which brought Mr. Lock back to remembrance of his
own insecure position in the world, and this was rendered still more
discomforting by what followed. For an amiable gentleman in a
check coat, after twice clearing his throat, sought to re-establish light
conversation, and asked the landlord whether there was yet any
news of Ted.
“I had a letter from him,” answered the landlord, coming out of a sort
of thoughtful trance.
“Thanking you for all the kindnesses you’ve showed him, I lay,”
hazarded the checkered gentleman.
“No,” returned the landlord, slowly. “’E only asked me to send on
after him a pair of boots he’d left behind for mendin’.”
“Fancy bothering about boots!” marvelled the other. “If my uncle
died and left me a greengrocery shop—”
“And a nice little business, too, by all accounts,” struck in an
individual in a mackintosh.
“Ay, by his accounts,” agreed the landlord. “If half he said was true,
he won’t have to do any more billiard-marking and odd-jobbing.”
“Not while the money lasts, at any rate,” said the man in the
mackintosh. “Have you got anyone to take his place yet?”
The landlord, shaking his head, replied that he had not yet found a
successor to Ted. Billiard-markers, he added, were scarce; people
who desired employment as such were, as a rule, of one or two
unsatisfactory classes, knowing either too little or too much.
Mr. Lock, assimilating this talk, lifted his eyes and peered as it were
through the mists of his troubles. Here, obviously, was a vacancy
going, and one which he was well qualified to fill, for his knowledge
of the billiard table was neither elementary nor academic. A post as
a marker and odd-job man at the “Royal William” appealed with
equal force to his temperament and his talents. He could conceive
of no form of employment more compatible with his desires. He
almost groaned with mortification at the thought that he had allowed
a faux pas to ruin his chances of so delectable a situation.
None the less, he determined to make sure that his opportunity was
indeed irrevocably lost, and, to that end, when the landlady had
temporarily quitted the apartment, he sidled up to the host of the
“Royal William,” and put a blunt inquiry to him.
“No chance whatever!” answered that worthy, regretfully shaking his
head.
“You’ll find me just the sort of chap you want,” pleaded Mr. Lock.
“I’ve no doubt of it,” accepted the landlord. “If it was only me what
had the say, you could start to-morrow. I don’t mind admitting
straight to your face that I’ve took to you. You’ve got a civil, well-
bred, amoosin’ way with you. You’d get on like a house afire with the
gents in the billiard-room. But—”
He shook his head again, sighed, and left the ellipsis to carry its own
implication.
“The missis, eh?” said Mr. Lock, sadly.
“The missis,” agreed the landlord.
“I suppose it ’ud be no good my trying to—”
“It ’ud be no good your trying anything!” interrupted the landlord, with
conviction. “You can bet she’s got her knife into you, and you can
bet nothing ’ud please her more than to twist it round like a
corkscrew.”
“Well, if I had a job here,” contended Mr. Lock, “she’d have a lot
more chances to twist it.”
“Look here, I’d give you the job if I dared, but I dare not, and that’s
flat and honest,” said the landlord, earnestly. “I daren’t! See?