Solution Manual for Problem Solving with C++ 10th Edition Savitch download
Solution Manual for Problem Solving with C++ 10th Edition Savitch download
https://testbankmall.com/product/solution-manual-for-problem-
solving-with-c-10th-edition-savitch/
https://testbankmall.com/product/solution-manual-for-data-abstraction-
and-problem-solving-with-c-walls-and-mirrors-7th-editioncarrano/
testbankmall.com
https://testbankmall.com/product/test-bank-for-introduction-to-
medical-surgical-nursing-5th-edition-linton/
testbankmall.com
Practical Crime Scene Processing and Investigation 2nd
Gardner Solution Manual
https://testbankmall.com/product/practical-crime-scene-processing-and-
investigation-2nd-gardner-solution-manual/
testbankmall.com
https://testbankmall.com/product/test-bank-for-understanding-
business-12th-edition-nickels/
testbankmall.com
https://testbankmall.com/product/solutions-manual-to-accompany-
building-construction-2nd-edition-0132148692/
testbankmall.com
https://testbankmall.com/product/test-bank-for-abnormal-psychology-
ninth-edition/
testbankmall.com
Solution Manual for Elementary Statistics: A Step By Step
Approach 10th Edition Bluman
https://testbankmall.com/product/solution-manual-for-elementary-
statistics-a-step-by-step-approach-10th-edition-bluman/
testbankmall.com
Copyright © 2018 by Pearson Education, Inc.
All right reserved. No part of this publication may be reproduced, stored in a retrieval system, or
transmitted, in any form or by any means, electronic, mechanical, photo-copying, recording, or any
other media embodiments now known or hereafter to become known, without the prior written
permission of the publisher. Manufactured in the United States of America.
Many of the designations used by manufacturers and sellers to distinguish their products are
claimed as trademarks. Where these designations appear in this book, and the publisher was aware
of a trademark claim, the designations have been printed in initial caps or all caps.
The programs and the applications presented in this book have been included for their
instructional value. They have been tested with care but are not guaranteed for any particular
purpose. The publisher does not offer any warranties or representations, nor does it accept any
liabilities with respect to the programs or applications.
Chapter 7 Arrays
Chapter 14 Recursion
Chapter 15 Inheritance
Chapter 17 Templates
Chapter 1
This document is intended to be a resource guide for instructors using Savitch, Problem Solving with
C++. This guide follows the text chapter by chapter. Each chapter of this guide contains the
following sections:
1. Solutions to, and remarks on, selected Programming Projects
2. Outline of topics in the chapter
3. General remarks on the chapter
***********************************************************************
// Ch1 Programming Project 3.cpp
//
// This program calculates the monetary value of a number of
// quarters, dimes, and nickels.
//
***********************************************************************
#include <iostream>
// ====================
// main function
// ====================
int main()
{
int quarters, dimes, nickels, total;
// Input coins
cout << "Enter number of quarters." << endl;
cin >> quarters;
6
Copyright © 2018 Pearson Education, Inc.
Savitch Instructor’s Resource Guide
Problem Solving w/ C++, 10e Chapter 1
#include <iostream>
using namespace std;
int main()
{
int ACCELERATION = 32;
cout << "\nThe object will fall " << distance << " feet in "
<< time << " seconds.\n";
return 0;
}
7
Copyright © 2018 Pearson Education, Inc.
Savitch Instructor’s Resource Guide
Problem Solving w/ C++, 10e Chapter 1
There seem to be three major approaches to teaching C++ as the first course in programming. In the
one approach, classes and objects are done very early, frequently with a library of some sort that
must be used with the text. In another, all of the ANSI C subset of C++ is covered prior to even
mentioning classes or objects. This text takes a third road that is more middle of the road. Here,
enough of the control constructs and functions are covered prior to doing classes and objects.
However, reorderings of the chapters are possible that allow any of these approaches.
Here is a "classes early" course that follows the text closely. This outline assumes no background in
computing. Topics beyond Chapter 11 may be studied as time permits.
Day days allotted
1 1 Startup business
2-3 2 Chapter 1: Introduction to Computers
4-8 5 Chapter 2: C++ Basics. If the students have programming experience, the time
spent can be significantly reduced.
9-11 3 Chapter 3: Flow of control
12-14 3 Chapter 4: Procedural Abstraction
Test 1
16-18 3 Chapter 5: Functions for all subtasks
19-22 4 Chapter 6: I/O Streams
23-27 5 Chapter 7: Arrays
Test 2
29-32 4 Chapter 8: Strings and Vectors
Chapter 9: Pointers and Dynamic Arrays
33-37 5 Chapter 10: Classes
38-41 3 Chapter 11: Friends and Overloaded Operators
Test 3
5 Chapter 12 Separate compilation and namespaces
3 Chapter 13 Pointers and Linked Lists
3 Chapter 14: Recursion
3 Chapter 15: Inheritance
3 Chapter 16: Exception Handling
3 Chapter 17: Templates
2 Chapter 18: Standard Template Library and C++11
Reorderings:
The author suggests a reordering in the preface that allow almost all of ANSI C (with the tighter
C++ type-checking) to be covered before classes. Several variants on this reordering that allow
classes a bit earlier are presented in the text. The author describes interdependency of the chapters
in the preface of the text. Other reorderings are certainly possible.
8
Copyright © 2018 Pearson Education, Inc.
Savitch Instructor’s Resource Guide
Problem Solving w/ C++, 10e Chapter 1
Chapter 1:
The student should do all the programming assignments in this chapter. These teach the locally
available program development system and familiarize the student with some of the more
common compiler errors. Error messages are quite specific to the compiler being used. It is very
important that the student learn these ideas as early as possible.
This chapter serves as an introduction to computers and the language of computers for those
students who have no computer experience. The terminology is very important. Many students
only want to learn how the programming language works, and seem to be unhappy when they
find that they are required to learn the terminology associated with the language. The students
who learn the terminology have less trouble by far with this course.
Students should be given an indication of the amount of work that must be done before coding
begins. There are instances where several man-years of work have gone into software before a
single line of code was written.
Emphasize the importance of the problem-solving phase of program design. This will save the
student work in the long run. It is further important to emphasize that the problem definition and
algorithm design phases may need correcting once the actual coding and testing is in process. This
is true even if the algorithm was carefully desktop tested. Emphasize that the program design
process is an 'iterative' process. You make a start, test, correct and repeat until you have a solution.
It is a fact that the sooner the coding is started (on most problems), the longer the problem will take
to finish. My students insist on learning this the hard way. The algorithm design can be given a
boost by dividing the problem definition into INPUT, PROCESS, OUTPUT phases. The algorithm
will be primarily concerned with PROCESS, but frequently just getting information into the
computer, or out of the computer in a desirable format is a significant part of the task, if not the
whole problem.
In the text, Section 1.4, subsection "Kinds of Program Errors", there is a discussion of compiler error
messages. The error message from g++ when the wrong operator << or >> is used for input or
output, is something like errormessage.cpp:8: no match for `_IO_ostream_withassign & >> int. The
point is that compiler error messages are not clear, and anything your can do to help students to
associate error messages with errors that cause them will help the student to gain some intuition in
debugging based on compiler messages.
9
Copyright © 2018 Pearson Education, Inc.
Savitch Instructor’s Resource Guide
Problem Solving w/ C++, 10e Chapter 1
Encourage students to put only one statement per line. When errors are made, as they inevitably
are, the compiler is better able to tell us which is the offending statement. The cost is little for the
convenience gained in ability to find errors. The student should take compiler warnings to heart. If
the compiler warns about something, and the student is not absolutely certain what the message is
warning about, the student should treat the warning like the error that it probably is. The bottom
line is that all warnings (in the first course, at least) should be treated as errors. Compilers vary
with respect to what is reported as an error and what is reported with a warning. The GNU project
C++ compiler, g++ is more permissive by default. Encourage your students to compile using
10
Copyright © 2018 Pearson Education, Inc.
Other documents randomly have
different content
The Project Gutenberg eBook of The Women
Who Came in the Mayflower
This ebook is for the use of anyone anywhere in the United
States and most other parts of the world at no cost and with
almost no restrictions whatsoever. You may copy it, give it away
or re-use it under the terms of the Project Gutenberg License
included with this ebook or online at www.gutenberg.org. If you
are not located in the United States, you will have to check the
laws of the country where you are located before using this
eBook.
Language: English
Foreword v
Index 109
ERRATA
Page
49 (And foot-notes elsewhere) read The Mayflower Descendant
for Mayflower Descendants.
49 Foot-note, read 53 Mt. Vernon St. for 9 Ashburton Pl.
78 Line 21, read two hundred and seventy for seventy.
79 Line 12, read inventory for will.
82 Line 12, omit Revolutionary.
84 Lines 4 and 5, read Edward Winslow and Peregrine White for
William Mullins and Miles Standish.
84 Line 21, read Petty coate with silke Lace for Pretty, etc.
86 Line 25, read step-mother for mother.
88 Line 10, read eighty for ninety years.
98 Line 14, read Abraham for Alexander.
102 Line 9, read Mercy for Mary.
I
ENDURANCE AND ADVENTURE: THE
VOYAGE AND LANDING
“So they left ye goodly and pleasante citie, which had been ther
resting-place near 12. years; but they knew they were pilgrimes, &
looked not much on those things, but lift up their eyes to ye
heavens, their dearest cuntrie, and quieted their spirits.”
—Bradford’s History of Plymouth Plantations. Chap. VII.
Chapter I
8. Mourt’s Relation.
Spring and summer came to bless them for their endurance and
unconscious heroism. Then they could appreciate the verdict of their
leaders, who chose the site of Plymouth as a “hopeful place,” with
running brooks, vines of sassafras and strawberry, fruit trees, fish
and wild fowl and “clay excellent for pots and will wash like soap.”[12]
So early was the spring in 1621 that on March the third there was a
thunder storm and “the birds sang in the woods most pleasantly.” On
March the sixteenth, Samoset came with Indian greeting. This visit
must have been one of mixed sentiments for the women and we can
read more than the mere words in the sentence, “We lodged him
that night at Stephen Hopkins’ house and watched him.”[13] Perhaps
it was in deference to the women that the men gave Samoset a hat,
a pair of stockings, shoes, a shirt and a piece of cloth to tie about
his waist. Samoset returned soon with Squanto or Tisquantum, the
only survivor of the Patuxet tribe of Indians which had perished of a
pestilence at Plymouth three years before. He shared with Hobomok
the friendship of the settlers for many years and both Indians gave
excellent service. Through the influence of Squanto the treaty was
made in the spring of 1621 with Massasoit, the first League of
Nations to preserve peace in the new world.
Squanto showed the men how to plant alewives or herring as
fertilizer for the Indian corn. He taught the boys and girls how to
gather clams and mussels on the shore and to “tread eels” in the
water that is still called Eel River. He gathered wild strawberries and
sassafras for the women and they prepared a “brew” which almost
equalled their ale of old England. The friendly Indians assisted the
men, as the seasons opened, in hunting wild turkeys, ducks and an
occasional deer, welcome additions to the store of fish, sea-biscuits
and cheese. We are told[14] that Squanto brought also a dog from his
Indian friends as a gift to the settlement. Already there were, at
least, two dogs, probably brought from Holland or England, a mastiff
and a spaniel[15] to give comfort and companionship to the women
and children, and to go with the men into the woods for timber and
game.
It seems paradoxical to speak of child-life in this hard-pressed,
serious-minded colony, but it was there and, doubtless, it was
normal in its joyous and adventuresome impulses. Under eighteen
years of age were the girls, Remember and Mary Allerton, Constance
and Damaris Hopkins, Elizabeth Tilley and, possibly, Desire Minter
and Humility Cooper. The boys were Bartholomew Allerton, who
“learned to sound the drum,” John Crakston, William Latham, Giles
Hopkins, John and Francis Billington, Richard More, Henry Sampson,
John Cooke, Resolved White, Samuel Fuller, Love and Wrestling
Brewster and the babies, Oceanus Hopkins and Peregrine White.
With the exception of Wrestling Brewster and Oceanus Hopkins, all
these children lived to ripe old age,—a credit not alone to their hardy
constitutions, but also to the care which the Plymouth women
bestowed upon their households.
The flowers that grew in abundance about the settlement must have
given them joy,—arbutus or “mayflowers,” wild roses, blue chicory,
Queen Anne’s lace, purple asters, golden-rod and the beautiful
sabbatia or “sentry” which is still found on the banks of the fresh
ponds near the town and is called “the Plymouth rose.” Edward
Winslow tells[16] of the drastic use of this bitter plant in developing
hardihood among Indian boys. Early in the first year one of these
fresh-water ponds, known as Billington Sea, was discovered by
Francis Billington when he had climbed a high hill and had reported
from it “a smaller sea.” Blackberries, blueberries, plums and cherries
must have been delights to the women and children. Medicinal herbs
were found and used by advice of the Indian friends; the bayberry’s
virtues as salve, if not as candle-light, were early applied to the
comforts of the households. Robins, bluebirds, “Bob Whites” and
other birds sang for the pioneers as they sing for the tourist and
resident in Plymouth today. The mosquito had a sting,—for Bradford
gave a droll and pungent answer to the discontented colonists who
had reported, in 1624, that “the people are much annoyed with
musquetoes.” He wrote:[17] “They are too delicate and unfitte to
begin new plantations and colonies that cannot enduer the biting of
a muskeet. We would wish such to keep at home till at least they be
muskeeto proof. Yet this place is as free as any and experience
teacheth that ye land is tild and ye woods cut downe, the fewer
there will be and in the end scarce any at all.” The end has not yet
come!
Good harvests and some thrilling incidents varied the hard conditions
of life for the women during 1621-2. Indian corn and barley
furnished a new foundation for many “a savory dish” prepared by
the housewives in the mortar and pestles, kettles and skillets which
they had brought from Holland. Nuts were used for food, giving
piquant flavor both to “cakes” baked in the fire and to the stuffing of
wild turkeys. The fare was simple, but it must have seemed a feast
to the Pilgrims after the months of self-denials and extremity.
Before the winter of 1621-2 was ended, seven log houses had been
built and four “common buildings” for storage, meetings and
workshops. Already clapboards and furs were stored to be sent back
to England to the merchant adventurers in the first ship. The seven
huts, with thatched roofs and chimneys on the outside, probably in
cob-house style, were of hewn planks, not of round logs.[18] The
fireplaces were of stones laid in clay from the abundant sand. In
1628 thatched roofs were condemned because of the danger of fire,
[19]
and boards or palings were substituted. During the first two
years or longer, light came into the houses through oiled paper in
the windows. From the plans left by Governor Bradford and the
record of the visit of De Rassieres to Plymouth, in 1627, one can
visualize this first street in New England, leading from Plymouth
harbor up the hill to the cannon and stockade where, later, was the
fort. At the intersection of the first street and a cross-highway stood
the Governor’s house. It was fitting that the lot nearest to the fort
hill should be assigned to Miles Standish and John Alden. All had free
access to the brook where flagons were filled for drink and where
the clothes were washed.
A few events that have been recorded by Winslow, Bradford and
Morton were significant and must have relieved the monotony of life.
On January fourth an eagle was shot, cooked and proved “to be
excellent meat; it was hardly to be discerned from mutton.”[20] Four
days later three seals and a cod were caught; we may assume that
they furnished oil, meat and skins for the household. About the
same time, John Goodman and Peter Brown lost their way in the
woods, remained out all night, thinking they heard lions roar
(mistaking wolves for lions), and on their return the next day John
Goodman’s feet were so badly frozen “that it was a long time before
he was able to go.”[21] Wild geese were shot and used for broth on
the ninth of February; the same day the Common House was set
ablaze, but was saved from destruction. It is easy to imagine the
exciting effects of such incidents upon the band of thirteen boys and
seven girls, already enumerated. In July, the cry of “a lost child”
aroused the settlement to a search for that “unwhipt rascal,” John
Billington, who had run away to the Nauset Indians at Eastham, but
he was found unharmed by a posse of men led by Captain Standish.
To the women one of the most exciting events must have been the
marriage on May 22, 1621, of Edward Winslow and Mistress Susanna
White. Her husband and two men-servants had died since The
Mayflower left England and she was alone to care for two young
boys, one a baby a few weeks old. Elizabeth Barker Winslow had
died seven weeks before the wedding day. Perhaps the Plymouth
women gossiped a little over the brief interval of mourning, but the
exigencies of the times easily explained the marriage, which was
performed by a magistrate, presumably the Governor.
Even more disturbing to the peaceful life was the first duel on June
18, between Edward Lister and Edward Dotey, both servants of
Stephen Hopkins. Tradition ascribed the cause to a quarrel over the
attractive elder daughter of their master, Constance Hopkins. The
duel was fought with swords and daggers; both youths were slightly
wounded in hand and thigh and both were sentenced, as
punishment, to have their hands and feet tied together and to fast
for twenty-four hours but, says a record,[22] “within an hour, because
of their great pains, at their own and their master’s humble request,
upon promise of better carriage, they were released by the
Governor.” It is easy to imagine this scene: Stephen Hopkins and his
wife appealing to the Governor and Captain Standish for leniency,
although the settlement was seriously troubled over the occurrence;
Elder Brewster and his wife deploring the lack of Christian affection
which caused the duel; Edward Winslow and his wife, dignified yet
tolerant; Goodwife Helen Billington scolding as usual; Priscilla
Mullins, Mary Chilton and Elizabeth Tilley condoling with the tearful
and frightened Constance Hopkins, while the children stand about,
excited and somewhat awed by the punishment and the distress of
the offenders.
Another day of unusual interest and industry for the householders
was the Thanksgiving Day when peace with the Indians and assured
prosperity seemed to follow the ample harvests. To this feast, which
lasted for three days or more, came ninety-one Indians bringing five
deer which they had killed and dressed. These were a great boon to
the women who must prepare meals for one hundred and forty
people. Wild turkeys, ducks, fish and clams were procured by the
colonists and cooked, perhaps with some marchpanes also, by the
more expert cooks. The serious prayers and psalms of the Pilgrims
were as amazing to the Indians as were the strange whoops,
dances, beads and feathers of the savages marvellous to the women
and children of Plymouth Colony.
In spite of these peaceable incidents there were occasional threats
of Indian treachery, like the theft of tools from two woodsmen and
the later bold challenge in the form of a headless arrow wrapped in