Download as pdf or txt
Download as pdf or txt
You are on page 1of 32

Visual C 2012 How to Program 5th

Edition Deitel Solutions Manual


Go to download the full and correct content document:
https://testbankfan.com/product/visual-c-2012-how-to-program-5th-edition-deitel-soluti
ons-manual/
More products digital (pdf, epub, mobi) instant
download maybe you interests ...

Visual C 2012 How to Program 5th Edition Deitel Test


Bank

https://testbankfan.com/product/visual-c-2012-how-to-program-5th-
edition-deitel-test-bank/

Visual C# How to Program 6th Edition Deitel Solutions


Manual

https://testbankfan.com/product/visual-c-how-to-program-6th-
edition-deitel-solutions-manual/

Visual Basic 2012 How to Program 6th Edition Deitel


Solutions Manual

https://testbankfan.com/product/visual-basic-2012-how-to-
program-6th-edition-deitel-solutions-manual/

Visual C# How to Program 6th Edition Deitel Test Bank

https://testbankfan.com/product/visual-c-how-to-program-6th-
edition-deitel-test-bank/
Visual C How to Program 6th Edition Deitel Test Bank

https://testbankfan.com/product/visual-c-how-to-program-6th-
edition-deitel-test-bank-2/

C How to Program 7th Edition Deitel Solutions Manual

https://testbankfan.com/product/c-how-to-program-7th-edition-
deitel-solutions-manual/

C++ How to Program 10th Edition Deitel Solutions Manual

https://testbankfan.com/product/c-how-to-program-10th-edition-
deitel-solutions-manual/

C How to Program 7th Edition Deitel Test Bank

https://testbankfan.com/product/c-how-to-program-7th-edition-
deitel-test-bank/

C++ How to Program 10th Edition Deitel Test Bank

https://testbankfan.com/product/c-how-to-program-10th-edition-
deitel-test-bank/
cshtp5_06.fm Page 1 Thursday, June 20, 2013 3:41 PM

Control Statements: Part 2 6


Who can control his fate?
—William Shakespeare

The used key is always bright.


—Benjamin Franklin

Every advantage in the past is


judged in the light of the final
issue.
—Demosthenes

Objectives
In this chapter you’ll:
■ Learn the essentials of
counter-controlled repetition.
■ Use the for and do…while
repetition statements.
■ Use the switch multiple
selection statement.
■ Use the break and
continue statements to
alter the flow of control.
■ Use the logical operators to
form complex conditional
expressions.
cshtp5_06.fm Page 2 Thursday, June 20, 2013 3:41 PM

2 Chapter 6 Control Statements: Part 2

Self-Review Exercises
6.1 Fill in the blanks in each of the following statements:
a) Typically, statements are used for counter-controlled repetition and
statements are used for sentinel-controlled repetition.
ANS: for, while.
b) The do…while statement tests the loop-continuation condition executing the
loop’s body; therefore, the body always executes at least once.
ANS: after.
c) The statement selects among multiple actions based on the possible values of
an integer variable or expression.
ANS: switch.
d) The statement, when executed in a repetition statement, skips the remaining
statements in the loop body and proceeds with the next iteration of the loop.
ANS: continue.
e) The operator can be used to ensure that two conditions are both true before
choosing a certain path of execution.
ANS: && (conditional AND) or & (boolean logical AND).
f) If the loop-continuation condition in a for header is initially , the for state-
ment’s body does not execute.
ANS: false.
g) Methods that perform common tasks and cannot be called on objects are called
methods.
ANS: static.

6.2 State whether each of the following is true or false. If false, explain why.
a) The default label is required in the switch selection statement.
ANS: False. The default label is optional. If no default action is needed, then there’s no
need for a default label.
b) The break statement is required in every case of a switch statement.
ANS: False. You could terminate the case with other statements, such as a return.
c) The expression (( x > y ) && ( a < b )) is true if either (x > y) is true or (a < b) is true.
ANS: False. Both of the relational expressions must be true for this entire expression to be
true when using the && operator.
d) An expression containing the || operator is true if either or both of its operands are true.
ANS: True.
e) The integer after the comma (,) in a format item (e.g., {0,4}) indicates the field width
of the displayed string.
ANS: True.
f) To test for a range of values in a switch statement, use a hyphen (–) between the start
and end values of the range in a case label.
ANS: False. The switch statement does not provide a mechanism for testing ranges of val-
ues, so you must list every value to test in a separate case label.
g) Listing cases consecutively with no statements between them enables the cases to per-
form the same set of statements.
ANS: True.
cshtp5_06.fm Page 3 Thursday, June 20, 2013 3:41 PM

Self-Review Exercises 3

6.3 Write a C# statement or a set of C# statements to accomplish each of the following tasks:
a) Sum the odd integers between 1 and 99, using a for statement. Assume that the integer
variables sum and count have been declared.
ANS: sum = 0;
for ( count = 1; count <= 99; count += 2 )
sum += count;
b) Calculate the value of 2.5 raised to the power of 3, using the Pow method.
ANS: double result = Math.Pow( 2.5, 3 );
c) Display the integers from 1 to 20 using a while loop and the counter variable i. Assume
that the variable i has been declared, but not initialized. Display only five integers per
line. [Hint: Use the calculation i % 5. When the value of this expression is 0, display a
newline character; otherwise, display a tab character. Use the Console.WriteLine()
method to output the newline character, and use the Console.Write( '\t' ) method to
output the tab character.]
ANS: i = 1;

while ( i <= 20 )
{
Console.Write( i );

if ( i % 5 == 0 )
Console.WriteLine();
else
Console.Write( '\t' );

++i;
} // end while
d) Repeat part (c), using a for statement.
ANS: for ( i = 1; i <= 20; ++i )
{
Console.Write( i );

if ( i % 5 == 0 )
Console.WriteLine();
else
Console.Write( '\t' );
} // end for

6.4 Find the error in each of the following code segments and explain how to correct it:
a) i = 1;
while ( i <= 10 );
++i;
}
ANS: Error: The semicolon after the while header causes an infinite loop, and there’s a
missing left brace for the body of the while statement.
Correction: Remove the semicolon and add a { before the loop’s body.
cshtp5_06.fm Page 4 Thursday, June 20, 2013 3:41 PM

4 Chapter 6 Control Statements: Part 2

b) for ( k = 0.1; k != 1.0; k += 0.1 )


Console.WriteLine( k );
ANS: Error: Using a floating-point number to control a for statement may not work, be-
cause floating-point numbers are represented only approximately by most comput-
ers.
Correction: Use an integer, and perform the proper calculation in order to get the val-
ues you desire:
for ( k = 1; k < 10; ++k )
Console.WriteLine( ( double ) k / 10 );
c) switch ( n )
{
case 1:
Console.WriteLine( "The number is 1" );
case 2:
Console.WriteLine( "The number is 2" );
break;
default:
Console.WriteLine( "The number is not 1 or 2" );
break;
} // end switch
ANS: Error: case 1 cannot fall through into case 2.
Correction: Terminate the case in some way, such as adding a break statement at the
end of the statements for the first case.
d) The following code should display the values 1 to 10:
n = 1;
while ( n < 10 )
Console.WriteLine( n++ );
ANS: Error: The wrong operator is used in the while repetition-continuation condition.
Correction: Use <= rather than <, or change 10 to 11.

Exercises
Note: Solutions to the programming exercises are located in the sol_ch06 folder.
6.5 Describe the four basic elements of counter-controlled repetition.
ANS: Counter-controlled repetition requires a control variable (or loop counter), an initial
value of the control variable, an increment (or decrement) by which the control vari-
able is modified each time through the loop, and a loop-continuation condition that
determines whether looping should continue.
6.6 Compare and contrast the while and for repetition statements.
ANS: The while and for repetition statements repeatedly execute a statement or set of
statements as long as a loop-continuation condition remains true. Both statements
execute their bodies zero or more times. The for repetition statement specifies the
counter-controlled-repetition details in its header, whereas the control variable in a
while statement normally is initialized before the loop and incremented in the loop's
body. Typically, for statements are used for counter-controlled repetition, and while
statements for sentinel-controlled repetition. However, while and for can each be
used for either repetition type.
cshtp5_06.fm Page 5 Thursday, June 20, 2013 3:41 PM

Exercises 5

6.7 Discuss a situation in which it would be more appropriate to use a do…while statement
than a while statement. Explain why.
ANS: If you want a statement or set of statements to execute at least once, then repeat based
on a condition, a do…while is more appropriate than a while (or a for). A do…while
statement tests the loop-continuation condition after executing the loop’s body;
therefore, the body always executes at least once. A while tests the loop-continuation
condition before executing the loop’s body, so the application would need to include
the statement(s) required to execute at least once both before the loop and in the body
of the loop. Using a do…while avoids this duplication of code. Suppose an applica-
tion needs to obtain an integer value from the user, and the integer value entered
must be positive for the application to continue. In this case, a do…while’s body
could contain the statements required to obtain the user input, and the loop-contin-
uation condition could determine whether the value entered is less than 0. If so, the
loop would repeat and prompt the user for input again. This would continue until
the user entered a value greater than or equal to zero. Once this criterion was met, the
loop-continuation condition would become false, and the loop would terminate, al-
lowing the application to continue past the loop. This process is often called validat-
ing input.
6.8 Compare and contrast the break and continue statements.
ANS: The break and continue statements alter the flow of control through a control state-
ment. The break statement, when executed in one of the repetition statements,
causes immediate exit from that statement. Execution typically continues with the
first statement after the control statement. In contrast, the continue statement, when
executed in a repetition statement, skips the remaining statements in the loop body
and proceeds with the next iteration of the loop. In while and do…while statements,
the application evaluates the loop-continuation test immediately after the continue
statement executes. In a for statement, the increment expression executes, then the
application evaluates the loop-continuation test.
6.9 Find and correct the error(s) in each of the following segments of code:
a) For ( i = 100, i >= 1, ++i )
Console.WriteLine( i );
b) The following code should display whether integer value is odd or even:
switch ( value % 2 )
{
case 0:
Console.WriteLine( "Even integer" );
case 1:
Console.WriteLine( "Odd integer" );
} // end switch

c) The following code should output the odd integers from 19 to 1:


for ( int i = 19; i >= 1; i += 2 )
Console.WriteLine( i );

d) The following code should output the even integers from 2 to 100:
counter = 2;
do
{
Console.WriteLine( counter );
counter += 2;
} While ( counter < 100 );
cshtp5_06.fm Page 6 Thursday, June 20, 2013 3:41 PM

6 Chapter 6 Control Statements: Part 2

6.10 (What Does This Code Do?) What does the following app do?

1 // Exercise 6.10 Solution: Printing.cs


2 using System;
3
4 public class Printing
5 {
6 public static void Main( string[] args )
7 {
8 for ( int i = 1; i <= 10; ++i )
9 {
10 for ( int j = 1; j <= 5; ++j )
11 Console.Write( '@' );
12
13 Console.WriteLine();
14 } // end outer for
15 } // end Main
16 } // end class Printing

ANS:

@@@@@
@@@@@
@@@@@
@@@@@
@@@@@
@@@@@
@@@@@
@@@@@
@@@@@
@@@@@

6.13 Factorials are used frequently in probability problems. The factorial of a positive integer n
(written n! and pronounced “n factorial”) is equal to the product of the positive integers from 1 to
n. Write an application that evaluates the factorials of the integers from 1 to 5. Display the results
in tabular format. What difficulty might prevent you from calculating the factorial of 20?
ANS: Calculating the factorial of 20 might be difficult because the value of 20! exceeds the
maximum value that can be stored in an int.
6.19 Assume that i = 1, j = 2, k = 3 and m = 2. What does each of the following statements display?
a) Console.WriteLine( i == 1 );
b) Console.WriteLine( j == 3 );
c) Console.WriteLine( ( i >= 1 ) && ( j < 4 ) );
d) Console.WriteLine( ( m <= 99 ) & ( k < m ) );
e) Console.WriteLine( ( j >= i ) || ( k == m ) );
f) Console.WriteLine( ( k + m < j ) | ( 3 - j >= k ) );
g) Console.WriteLine( !( k > m ) );
a) Console.WriteLine( i == 1 );
ANS: true.
b) Console.WriteLine( j == 3 );
ANS: false.
cshtp5_06.fm Page 7 Thursday, June 20, 2013 3:41 PM

Exercises 7

c) Console.WriteLine( ( i >= 1 ) && ( j < 4 ) );


ANS: true.
d) Console.WriteLine( ( m <= 99 ) & ( k < m ) );
ANS: false.
e) Console.WriteLine( ( j >= i ) || ( k == m ) );
ANS: true.
f) Console.WriteLine( ( k + m < j ) | ( 3 - j >= k ) );
ANS: false.
g) Console.WriteLine( !( k > m ) );
ANS: false.

6.25 (Structured Equivalent of break Statement) A criticism of the break statement and the
continue statement (in a loop) is that each is unstructured. Actually, break and continue statements
can always be replaced by structured statements, although doing so can be awkward. Describe in
general how you would remove any break statement from a loop in an app and replace it with a
structured equivalent. [Hint: The break statement exits a loop from the body of the loop. The other
way to exit is by failing the loop-continuation test. Consider using in the loop-continuation test a
second test that indicates “early exit because of a ‘break’ condition.”] Use the technique you develop
here to remove the break statement from the app in Fig. 6.12.
ANS: A loop can be written without a break by placing in the loop-continuation test a sec-
ond test that indicates “early exit because of a ‘break’ condition.” Alternatively, the
break can be replaced by a statement that makes the original loop-continuation test
immediately false, so that the loop terminates.
6.26 (What Does This Code Do?) What does the following code segment do?
for ( int i = 1; i <= 5; ++i )
{
for ( int j = 1; j <= 3; ++j )
{
for ( int k = 1; k <= 4; ++k )
Console.Write( '*' );

Console.WriteLine();
} // end middle for

Console.WriteLine();
} // end outer for
cshtp5_06.fm Page 8 Thursday, June 20, 2013 3:41 PM

8 Chapter 6 Control Statements: Part 2

ANS:

****
****
****

****
****
****

****
****
****

****
****
****

****
****
****

6.27 (Structured Equivalent of continue Statement) Describe in general how you would re-
move any continue statement from a loop in an app and replace it with some structured equivalent.
Use the technique you develop here to remove the continue statement from the app in Fig. 6.13.
ANS: A loop can be rewritten without a continue statement by moving all the code that
appears in the body of the loop after the continue statement into an if statement that
tests for the opposite of the continue condition. Thus, the code that was originally
after the continue statement executes only when the if statement’s conditional ex-
pression is true (i.e., the “continue” condition is false). When the “continue” condi-
tion is true, the body of the if does not execute and the application “continues” to
the next iteration of the loop by not executing the remaining code in the loop’s body.
The answer shown here removes the continue statement from the if statement.
Another random document with
no related content on Scribd:
112. At this time peas were issued whole. Split peas were not issued till about
1856—after the Russian war.
113. Rear-Admiral Trogoff, with his flag in the Commerce de Marseille, left
Toulon in company, with the English but he died within a few months.—Chevalier,
op. cit. pp. 90, 91.
114. A recognised form of encouragement. In the court martial on the officers
of the Ambuscade, captured by the French on the 14th December, 1798 (James, ii.
273 seq.), the boatswain was asked, ‘Did you hear Lieut. Briggs call to the people to
encourage them to come aft and fight?’ and the answer was, ‘He called down to the
waist to come up and assist. I believe it was “Damn your eyes, come up.”‘—Minutes
of the Court Martial. Cf. Byron’s Don Juan, xi. 12.
115. It is only by the aid of such occasional and incidental notices that we can
now realise what a very real thing the Test Act of 1673 was, and continued to be, till
its repeal in 1828. It required ‘all persons holding any office of profit or trust, civil
or military, under the crown, to take the oaths of allegiance and supremacy, receive
the sacrament of the Lord’s Supper according to the rites of the Church of England,
and subscribe the declaration against transubstantiation.’
116. As was the case in January, 1855.
117. Richard Poulden. Died, a rear-admiral, 1845.
118. Mr. Marriott, Assistant Secretary of the Royal Meteorological Society, has
kindly supplied the following note:—The frost began about the middle of December
1794, was excessively severe in January, and continued till the end of March. There
were large falls of snow, and the consequent floods were so great that nearly all the
bridges in England were injured. The greatest cold recorded was at Maidstone on
January 25, when a thermometer laid on the snow showed –14° F., and another,
five feet above the surface, –10° F. There was a thaw on January 26–7, but on the
28th the frost returned and continued. Mr. A. Rollin, secretary to the captain
superintendent at Sheerness, has also been so good as to send the following note,
at the instance of Rear-Admiral C. H. Adair: ‘In January 1795 King’s Ferry was
frozen and also Sheerness Harbour. People walked from ships in the harbour and
from the Little Nore to Sheerness on the ice for provisions.’ Mr. Rollin mentions
similar frosts in January 1776, and January 1789; but has no record of the frost of
January 1855, when the harbour, and seaward as far as the eye could reach, was
frozen over, forcibly recalling Arctic memories.
119. Two very well-known singers. There are probably many still with us who
have heard Braham—he did not retire finally till 1852—if only in ‘The Bay of
Biscay.’ Incledon, who died in 1826, served, when a very young man, as an
ordinary seaman on board the Formidable, Rodney’s flagship in the West Indies.
According to the tradition still living 50 or 60 years ago, his talent was found out,
and he used to be sent for, first to the ward room and afterwards to the admiral’s
cabin, to sing after dinner; and when the ship paid off, he came on shore provided
with letters of introduction which made the rest of his way easy. The details of his
service in the navy, as given in the D.N.B., are certainly erroneous. The Formidable
did not go to the West Indies till 1782; and Cleland did not then command her.
120. Rear-admiral Sir Hugh Cloberry Christian. See D.N.B.
121. So in MS., evidently a slip for ‘hawse.’
122. The tack hauled out only two thirds of the length of the jib-boom. Cf.
D’Arcy Lever’s Young Sea Officer’s Sheet Anchor (1808), p. 84 and fig. 450. Setting
the jib in this way seems to have gone out of use in the navy with the introduction
of flying jibs.
123. Sc. had the swell on the bow.
124. This was evidently written with very imperfect knowledge of the facts in
either case. From the naval point of view, the only good account of this expedition
to Bantry Bay is that contributed by Admiral Colomb to the Journal of the R.U.S.
Institution, xxxvi. 17 (Jan. 1892).
125. Possibly; but on joining the Hind, his name was entered John Timothy
Coghlan in the pay-book.
126. Captain Fanshawe commanded the Monmouth in Byron’s action at
Grenada, July 6, 1779, and the Namur on April 12, 1782. He was for many years
resident commissioner at Plymouth. Cf. N.R.S. vols. xii., xix. and xxiv.
127. This power of committing for contempt belongs inherently to a court
martial, as a court of record, though it is now seldom, if ever, called on to exercise
it (Thring’s Criminal Law of the Navy, 2nd edit., p. 103).
128. This has no meaning, unless we can suppose ‘Apollo’ to have been written
inadvertently for ‘Favorite.’
129. On the part of the French this was a very old contention; sometimes, as
here, with a view to obtaining better treatment as prisoners; at other times, with a
view to being exchanged on more favourable terms. Cf. Laughton’s Studies in
Naval History, pp. 258–9.
130. One of the Dutch ships taken at the Cape of Good Hope in August 1796.
131. Joseph Peyton; admiral, June 1, 1795.
132. Taken possession of in Cork Harbour, Aug. 22, 1795.
133. James Hardy, of the Dictator.
134. A similar method of beautifying a ship fitting out was the rule rather than
the exception till long after Gardner’s time.
135. In 1852 the crew of a whaler in Baffin’s Bay mutinied and struck work, till
a pan of burning sulphur ‘cleared lower deck.’
136. Taken at Camperdown.
137. Taken at the Cape.
138. September 28.
139. October 9. Cf. D.N.B.
140. Castlereagh was at this time lieutenant-colonel of the Londonderry
militia and acting chief secretary for Ireland. The reference would seem to be to the
discreditable conduct of the militia in ‘the race of Castlebar,’ in the previous year.
Castlereagh, of course, had nothing directly to do with it.
141. Gardner’s memory is here in fault. The court martial on Brice (for ‘having
at different times uttered words of sedition and mutiny ... and for behaving in a
scandalous manner unbecoming the character of an officer and a gentleman’) was
held on board the Blonde on 12, 13 June 1798; that on Tripp, on 6–11 Dec. 1799,
was held on board the Pallas.
142. October 14, 1799.
143. Sir John Fielding, brother of the better-known Henry Fielding the
novelist, was blind from his birth. It was said that he knew 3,000 thieves by their
voice.
144. Nag.
145. Milk-pails.
146. The word is ‘piseachbuidhe,’ porridge made of Indian meal. A hundred
years ago, possibly peas pudding.
147. Potatoes stewed in butter, with cabbage or onions.
148. Are we to understand that Huish also was well up in his Virgil, if only in
Dryden’s version? Perhaps rather the writer thought this was what he ought to
have said.
149. Attention is called by Ralfe (Naval Biography, ii. 286) to the remarkable
fact that a fleet of 28 ships of the line should be under the command of a rear-
admiral.
150. The captains’ names, left blank in the MS., are filled in from Schomberg;
but it should be noted that when rapid changes are being made, it is frequently
difficult to say who commanded a ship at a particular time. Some of the names
given by Gardner do not agree with Schomberg’s lists.
151. Bonetta sloop, 25th October, 1801.—James, iii. 482.
152. A temperature so stated has no meaning. 112° is far above the shade
temperature of Jamaica, and below the temperature in the sun. But it seems that
these parties were working during the heat of the day.
153. Off Monte Christo, 20–21 March 1780. See Beatson, v. 96; Chevalier, i.
193.
154. When writing this, Gardner seems to have forgotten that eight years
before she had carried her 74 guns with some credit in the fleet under Lord Howe.
155. Rear-Admiral Robert Montagu.
156. 15th September, 1825. See Times of 16th September and following days.
157. It is easy to believe that the Goliath’s officers did not consider this man of
‘many vices’ a desirable passenger, even in the gun room; but as he had not been
found out by a court martial, it cannot but seem curious now, that he was not
ordered a passage in the mess of his rank.
158. 1831. Cf. Marshall, ii. 848, 882.
159. Captain, 1781; first commissioner of transport, 1796; knighted, 1804;
baronet, 1809; died, 1823.
160. See Appendix, p. 265.
161. Gardner’s memory must here have been playing him false. The distance
from Fairlight to Boulogne and the adjacent coast is fully 35 miles: the camp had
been broken up in the previous September, and the soldiers that had formed it
were far away, at Vienna or its neighbourhood; as Gardner, at the time, must have
known.
162. We are so accustomed to talk of ‘Arry as a product of the late nineteenth
century, railways and cheap return tickets, that it is neither uninteresting nor
socially unimportant to note that he existed in 1806. Increase of population and
excursion tickets have merely swelled his numbers.
163. There is some confusion here. Wadeson and Parr were both assistant
masters when Sumner died suddenly in September, 1771. Wadeson was certainly
not offered the succession, and his name does not seem to have been officially
mentioned in connection with it. On the other hand, Parr’s claims were strongly
urged, and the refusal of the Governors to appoint him caused a violent ‘meeting’
among the boys. It is a very strange story, told at length in Johnstone, Works of
Samuel Parr, i. 55 seq.; Thornton, Harrow School and its Surroundings, Chap.
viii.; Report on the MSS. of Lady Du Cane (Hist. MSS. Comm.), 229 seq.
164. At this time this was still the usual form of subscription from a superior,
whether social—as a son of the king—or official, as the navy board (collectively)—to
an inferior. Naval officers, at any rate, will scarcely need to be reminded of the
story of the eccentric Sir John Phillimore (cf. D.N.B.) who signed a letter to the
navy board in the same way; and on being censured for so doing, signed his reply
‘No longer your affectionate friend.’
The Navy Records Society, which has been established for the
purpose of printing rare or unpublished works of naval interest, aims
at rendering accessible the sources of our naval history, and at
elucidating questions of naval archæology, construction,
administration, organisation and social life.

The Society has already issued:—


In 1894: Vols. I. and II. State Papers relating to the Defeat of
the Spanish Armada, Anno 1588. Edited by Professor J. K.
Laughton. (30s.)
In 1895: Vol. III. Letters of Lord Hood, 1781–82. Edited by Mr.
David Hannay. (None available.)
Vol. IV. Index to James’s Naval History, by Mr. C. G. Toogood.
Edited by the Hon. T. A. Brassey. (12s. 6d.)
Vol. V. Life of Captain Stephen Martin, 1666–1740. Edited by
Sir Clements R. Markham. (None available.)
In 1896: Vol. VI. Journal of Rear-Admiral Bartholomew James,
1752–1828. Edited by Professor J. K. Laughton and Commander J. Y.
F. Sulivan. (10s. 6d.)
Vol. VII. Hollond’s Discourses of the Navy, 1638 and 1658.
Edited by Mr. J. R. Tanner. (12s. 6d.)
Vol. VIII. Naval Accounts and Inventories in the Reign of
Henry VII. Edited by Mr. M. Oppenheim. (10s. 6d.)
In 1897: Vol. IX. Journal of Sir George Rooke. Edited by Mr.
Oscar Browning. (10s. 6d.)
Vol. X. Letters and Papers relating to the War with France,
1512–13. Edited by M. Alfred Spont. (10s. 6d.)
Vol. XI. Papers relating to the Spanish War, 1585–87. Edited by
Mr. Julian Corbett. (10s. 6d.)
In 1898: Vol. XII. Journals and Letters of Admiral of the Fleet
Sir Thomas Byam Martin, 1773–1854 (Vol. II.), Edited by Admiral
Sir R. Vesey Hamilton. (See XXIV.)
Vol. XIII. Papers relating to the First Dutch War. 1652–54 (Vol.
I.). Edited by Mr. S. R. Gardiner, (10s. 6d.)
Vol. XIV. Papers relating to the Blockade of Brest, 1803–5 (Vol.
I.). Edited by Mr. J. Leyland. (See XXI.)
In 1899: Vol. XV. History of the Russian Fleet during the Reign
of Peter the Great. By a Contemporary Englishman. Edited by
Admiral Sir Cyprian Bridge, (10s. 6d.)
Vol. XVI. Logs of the Great Sea Fights, 1794–1805 (Vol. I.).
Edited by Vice-Admiral Sir T. Sturges Jackson. (See XVIII.)
Vol. XVII. Papers relating to the First Dutch War, 1652–54
(Vol. II.). Edited by Mr. S. R. Gardiner, (10s. 6d.)
In 1900: Vol. XVIII. Logs of the Great Sea Fights (Vol. II.).
Edited by Sir T. S. Jackson. (Two vols. 25s.)
Vol. XIX. Journals and Letters of Sir T. Byam Martin (Vol. III.).
Edited by Sir R. Vesey Hamilton. (See XXIV.)
In 1901: Vol. XX. The Naval Miscellany (Vol. I.). Edited by the
Secretary. (15s.)
Vol. XXI. Papers relating to the Blockade of Brest, 1803–5 (Vol.
II.). Edited by Mr. John Leyland. (Two vols. 25s.)
In 1902: Vols. XXII. and XXIII. The Naval Tracts of Sir William
Monson (Vols. I. and II.). Edited by Mr. M. Oppenheim. (Two vols.
25s.)
Vol. XXIV. Journals and Letters of Sir T. Byam Martin (Vol. I.).
Edited by Sir R. Vesey Hamilton. (Three vols. 31s. 6d.)
In 1903: Vol. XXV. Nelson and the Neapolitan Jacobins. Edited
by Mr. H. C. Gutteridge. (12s. 6d.)
Vol. XXVI. A Descriptive Catalogue of the Naval MSS. in the
Pepysian Library (Vol. I.). Edited by Mr. J. R. Tanner. (15s.)
In 1904: Vol. XXVII. A Descriptive Catalogue of the Naval MSS.
in the Pepysian Library (Vol. II.). Edited by Mr. J. R. Tanner. (12s.
6d.)
Vol. XXVIII. The Correspondence of Admiral John Markham,
1801–7. Edited by Sir Clements R. Markham. (12s. 6d.)
In 1905: Vol. XXIX. Fighting Instructions, 1530–1816. Edited by
Mr. Julian Corbett. (10s. 6d.)
Vol. XXX. Papers relating to the First Dutch War, 1652–54
(Vol. III.). Edited by the late Dr. S. R. Gardiner and Mr. C. T.
Atkinson. (12s. 6d.)
In 1906: Vol. XXXI. The Recollections of Commander James
Anthony Gardner, 1775–1814. Edited by Sir R. Vesey Hamilton and
Professor J. K. Laughton.

To follow:
Vol. XXXII. Select Correspondence of Sir Charles Middleton,
afterwards Lord Barham, 1759–1806 (Vol. I.). Edited by Professor
J. K. Laughton.
Other works in preparation, in addition to further volumes of
Mr. Tanner’s Descriptive Catalogue, of Sir William Monson’s Tracts,
of The First Dutch War, which will be edited by Mr. C. T. Atkinson,
and of The Naval Miscellany, are The Journal of Captain
(afterwards Sir John) Narbrough, 1672–73, to be edited by Professor
J. K. Laughton; A Series of Contemporary Pictures forming
Panoramic Views of the Battles of the Third Dutch War, 1672–3,
drawn for the first Lord Dartmouth, and lent to the Society by the
present Earl, to be reproduced in facsimile under the
superintendence of Mr. J. S. Corbett; Official Documents illustrating
the Social Life and Internal Discipline of the Navy in the XVIIIth
Century, to be edited by Professor J. K. Laughton; Select
Correspondence of the great Earl of Chatham and his Sons, to be
edited by Professor J. K. Laughton; and a Collection of Naval Songs
and Ballads, to be edited by Professor C. H. Firth.

Any person wishing to become a Member of the Society is


requested to apply to the Secretary (Professor Laughton, 9 Pepys
Road, Wimbledon, S. W.), who will submit his name to the Council.
The Annual Subscription is One Guinea, the payment of which
entitles the Member to receive one copy of all works issued by the
Society for that year. The publications are not offered for general
sale; but Members can obtain a complete set of the volumes at the
rate of one guinea for each year. On first joining the Society, a new
Member may obtain a complete set at the reduced price of 12s. 6d.
for each year except the last three, for which the full price of one
guinea must be paid. Single volumes can be obtained by Members at
the prices marked to each.
December 1906.

PRINTED BY
SPOTTISWOODE AND CO. LTD., NEW-STREET SQUARE
LONDON
TRANSCRIBER’S NOTES

Page Changed from Changed to


257 and shak-her hand and shaking her hand

1. Silently corrected palpable typographical errors;


retained non-standard spellings and dialect.
2. Reindexed footnotes using numbers and collected
together at the end of the last chapter.
*** END OF THE PROJECT GUTENBERG EBOOK
RECOLLECTIONS OF JAMES ANTHONY GARDNER,
COMMANDER R.N. (1775–1814) ***

Updated editions will replace the previous one—the old editions


will be renamed.

Creating the works from print editions not protected by U.S.


copyright law means that no one owns a United States copyright
in these works, so the Foundation (and you!) can copy and
distribute it in the United States without permission and without
paying copyright royalties. Special rules, set forth in the General
Terms of Use part of this license, apply to copying and
distributing Project Gutenberg™ electronic works to protect the
PROJECT GUTENBERG™ concept and trademark. Project
Gutenberg is a registered trademark, and may not be used if
you charge for an eBook, except by following the terms of the
trademark license, including paying royalties for use of the
Project Gutenberg trademark. If you do not charge anything for
copies of this eBook, complying with the trademark license is
very easy. You may use this eBook for nearly any purpose such
as creation of derivative works, reports, performances and
research. Project Gutenberg eBooks may be modified and
printed and given away—you may do practically ANYTHING in
the United States with eBooks not protected by U.S. copyright
law. Redistribution is subject to the trademark license, especially
commercial redistribution.

START: FULL LICENSE


THE FULL PROJECT GUTENBERG LICENSE
PLEASE READ THIS BEFORE YOU DISTRIBUTE OR USE THIS WORK

To protect the Project Gutenberg™ mission of promoting the


free distribution of electronic works, by using or distributing this
work (or any other work associated in any way with the phrase
“Project Gutenberg”), you agree to comply with all the terms of
the Full Project Gutenberg™ License available with this file or
online at www.gutenberg.org/license.

Section 1. General Terms of Use and


Redistributing Project Gutenberg™
electronic works
1.A. By reading or using any part of this Project Gutenberg™
electronic work, you indicate that you have read, understand,
agree to and accept all the terms of this license and intellectual
property (trademark/copyright) agreement. If you do not agree to
abide by all the terms of this agreement, you must cease using
and return or destroy all copies of Project Gutenberg™
electronic works in your possession. If you paid a fee for
obtaining a copy of or access to a Project Gutenberg™
electronic work and you do not agree to be bound by the terms
of this agreement, you may obtain a refund from the person or
entity to whom you paid the fee as set forth in paragraph 1.E.8.

1.B. “Project Gutenberg” is a registered trademark. It may only


be used on or associated in any way with an electronic work by
people who agree to be bound by the terms of this agreement.
There are a few things that you can do with most Project
Gutenberg™ electronic works even without complying with the
full terms of this agreement. See paragraph 1.C below. There
are a lot of things you can do with Project Gutenberg™
electronic works if you follow the terms of this agreement and
help preserve free future access to Project Gutenberg™
electronic works. See paragraph 1.E below.
1.C. The Project Gutenberg Literary Archive Foundation (“the
Foundation” or PGLAF), owns a compilation copyright in the
collection of Project Gutenberg™ electronic works. Nearly all the
individual works in the collection are in the public domain in the
United States. If an individual work is unprotected by copyright
law in the United States and you are located in the United
States, we do not claim a right to prevent you from copying,
distributing, performing, displaying or creating derivative works
based on the work as long as all references to Project
Gutenberg are removed. Of course, we hope that you will
support the Project Gutenberg™ mission of promoting free
access to electronic works by freely sharing Project
Gutenberg™ works in compliance with the terms of this
agreement for keeping the Project Gutenberg™ name
associated with the work. You can easily comply with the terms
of this agreement by keeping this work in the same format with
its attached full Project Gutenberg™ License when you share it
without charge with others.

1.D. The copyright laws of the place where you are located also
govern what you can do with this work. Copyright laws in most
countries are in a constant state of change. If you are outside
the United States, check the laws of your country in addition to
the terms of this agreement before downloading, copying,
displaying, performing, distributing or creating derivative works
based on this work or any other Project Gutenberg™ work. The
Foundation makes no representations concerning the copyright
status of any work in any country other than the United States.

1.E. Unless you have removed all references to Project


Gutenberg:

1.E.1. The following sentence, with active links to, or other


immediate access to, the full Project Gutenberg™ License must
appear prominently whenever any copy of a Project
Gutenberg™ work (any work on which the phrase “Project
Gutenberg” appears, or with which the phrase “Project
Gutenberg” is associated) is accessed, displayed, performed,
viewed, copied or distributed:

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.

1.E.2. If an individual Project Gutenberg™ electronic work is


derived from texts not protected by U.S. copyright law (does not
contain a notice indicating that it is posted with permission of the
copyright holder), the work can be copied and distributed to
anyone in the United States without paying any fees or charges.
If you are redistributing or providing access to a work with the
phrase “Project Gutenberg” associated with or appearing on the
work, you must comply either with the requirements of
paragraphs 1.E.1 through 1.E.7 or obtain permission for the use
of the work and the Project Gutenberg™ trademark as set forth
in paragraphs 1.E.8 or 1.E.9.

1.E.3. If an individual Project Gutenberg™ electronic work is


posted with the permission of the copyright holder, your use and
distribution must comply with both paragraphs 1.E.1 through
1.E.7 and any additional terms imposed by the copyright holder.
Additional terms will be linked to the Project Gutenberg™
License for all works posted with the permission of the copyright
holder found at the beginning of this work.

1.E.4. Do not unlink or detach or remove the full Project


Gutenberg™ License terms from this work, or any files
containing a part of this work or any other work associated with
Project Gutenberg™.
1.E.5. Do not copy, display, perform, distribute or redistribute
this electronic work, or any part of this electronic work, without
prominently displaying the sentence set forth in paragraph 1.E.1
with active links or immediate access to the full terms of the
Project Gutenberg™ License.

1.E.6. You may convert to and distribute this work in any binary,
compressed, marked up, nonproprietary or proprietary form,
including any word processing or hypertext form. However, if
you provide access to or distribute copies of a Project
Gutenberg™ work in a format other than “Plain Vanilla ASCII” or
other format used in the official version posted on the official
Project Gutenberg™ website (www.gutenberg.org), you must, at
no additional cost, fee or expense to the user, provide a copy, a
means of exporting a copy, or a means of obtaining a copy upon
request, of the work in its original “Plain Vanilla ASCII” or other
form. Any alternate format must include the full Project
Gutenberg™ License as specified in paragraph 1.E.1.

1.E.7. Do not charge a fee for access to, viewing, displaying,


performing, copying or distributing any Project Gutenberg™
works unless you comply with paragraph 1.E.8 or 1.E.9.

1.E.8. You may charge a reasonable fee for copies of or


providing access to or distributing Project Gutenberg™
electronic works provided that:

• You pay a royalty fee of 20% of the gross profits you derive from
the use of Project Gutenberg™ works calculated using the
method you already use to calculate your applicable taxes. The
fee is owed to the owner of the Project Gutenberg™ trademark,
but he has agreed to donate royalties under this paragraph to
the Project Gutenberg Literary Archive Foundation. Royalty
payments must be paid within 60 days following each date on
which you prepare (or are legally required to prepare) your
periodic tax returns. Royalty payments should be clearly marked
as such and sent to the Project Gutenberg Literary Archive
Foundation at the address specified in Section 4, “Information
about donations to the Project Gutenberg Literary Archive
Foundation.”

• You provide a full refund of any money paid by a user who


notifies you in writing (or by e-mail) within 30 days of receipt that
s/he does not agree to the terms of the full Project Gutenberg™
License. You must require such a user to return or destroy all
copies of the works possessed in a physical medium and
discontinue all use of and all access to other copies of Project
Gutenberg™ works.

• You provide, in accordance with paragraph 1.F.3, a full refund of


any money paid for a work or a replacement copy, if a defect in
the electronic work is discovered and reported to you within 90
days of receipt of the work.

• You comply with all other terms of this agreement for free
distribution of Project Gutenberg™ works.

1.E.9. If you wish to charge a fee or distribute a Project


Gutenberg™ electronic work or group of works on different
terms than are set forth in this agreement, you must obtain
permission in writing from the Project Gutenberg Literary
Archive Foundation, the manager of the Project Gutenberg™
trademark. Contact the Foundation as set forth in Section 3
below.

1.F.

1.F.1. Project Gutenberg volunteers and employees expend


considerable effort to identify, do copyright research on,
transcribe and proofread works not protected by U.S. copyright
law in creating the Project Gutenberg™ collection. Despite
these efforts, Project Gutenberg™ electronic works, and the
medium on which they may be stored, may contain “Defects,”
such as, but not limited to, incomplete, inaccurate or corrupt
data, transcription errors, a copyright or other intellectual
property infringement, a defective or damaged disk or other
medium, a computer virus, or computer codes that damage or
cannot be read by your equipment.

1.F.2. LIMITED WARRANTY, DISCLAIMER OF DAMAGES -


Except for the “Right of Replacement or Refund” described in
paragraph 1.F.3, the Project Gutenberg Literary Archive
Foundation, the owner of the Project Gutenberg™ trademark,
and any other party distributing a Project Gutenberg™ electronic
work under this agreement, disclaim all liability to you for
damages, costs and expenses, including legal fees. YOU
AGREE THAT YOU HAVE NO REMEDIES FOR NEGLIGENCE,
STRICT LIABILITY, BREACH OF WARRANTY OR BREACH
OF CONTRACT EXCEPT THOSE PROVIDED IN PARAGRAPH
1.F.3. YOU AGREE THAT THE FOUNDATION, THE
TRADEMARK OWNER, AND ANY DISTRIBUTOR UNDER
THIS AGREEMENT WILL NOT BE LIABLE TO YOU FOR
ACTUAL, DIRECT, INDIRECT, CONSEQUENTIAL, PUNITIVE
OR INCIDENTAL DAMAGES EVEN IF YOU GIVE NOTICE OF
THE POSSIBILITY OF SUCH DAMAGE.

1.F.3. LIMITED RIGHT OF REPLACEMENT OR REFUND - If


you discover a defect in this electronic work within 90 days of
receiving it, you can receive a refund of the money (if any) you
paid for it by sending a written explanation to the person you
received the work from. If you received the work on a physical
medium, you must return the medium with your written
explanation. The person or entity that provided you with the
defective work may elect to provide a replacement copy in lieu
of a refund. If you received the work electronically, the person or
entity providing it to you may choose to give you a second
opportunity to receive the work electronically in lieu of a refund.
If the second copy is also defective, you may demand a refund
in writing without further opportunities to fix the problem.

1.F.4. Except for the limited right of replacement or refund set


forth in paragraph 1.F.3, this work is provided to you ‘AS-IS’,
WITH NO OTHER WARRANTIES OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO
WARRANTIES OF MERCHANTABILITY OR FITNESS FOR
ANY PURPOSE.

1.F.5. Some states do not allow disclaimers of certain implied


warranties or the exclusion or limitation of certain types of
damages. If any disclaimer or limitation set forth in this
agreement violates the law of the state applicable to this
agreement, the agreement shall be interpreted to make the
maximum disclaimer or limitation permitted by the applicable
state law. The invalidity or unenforceability of any provision of
this agreement shall not void the remaining provisions.

1.F.6. INDEMNITY - You agree to indemnify and hold the


Foundation, the trademark owner, any agent or employee of the
Foundation, anyone providing copies of Project Gutenberg™
electronic works in accordance with this agreement, and any
volunteers associated with the production, promotion and
distribution of Project Gutenberg™ electronic works, harmless
from all liability, costs and expenses, including legal fees, that
arise directly or indirectly from any of the following which you do
or cause to occur: (a) distribution of this or any Project
Gutenberg™ work, (b) alteration, modification, or additions or
deletions to any Project Gutenberg™ work, and (c) any Defect
you cause.

Section 2. Information about the Mission of


Project Gutenberg™
Project Gutenberg™ is synonymous with the free distribution of
electronic works in formats readable by the widest variety of
computers including obsolete, old, middle-aged and new
computers. It exists because of the efforts of hundreds of
volunteers and donations from people in all walks of life.

Volunteers and financial support to provide volunteers with the


assistance they need are critical to reaching Project
Gutenberg™’s goals and ensuring that the Project Gutenberg™
collection will remain freely available for generations to come. In
2001, the Project Gutenberg Literary Archive Foundation was
created to provide a secure and permanent future for Project
Gutenberg™ and future generations. To learn more about the
Project Gutenberg Literary Archive Foundation and how your
efforts and donations can help, see Sections 3 and 4 and the
Foundation information page at www.gutenberg.org.

Section 3. Information about the Project


Gutenberg Literary Archive Foundation
The Project Gutenberg Literary Archive Foundation is a non-
profit 501(c)(3) educational corporation organized under the
laws of the state of Mississippi and granted tax exempt status by
the Internal Revenue Service. The Foundation’s EIN or federal
tax identification number is 64-6221541. Contributions to the
Project Gutenberg Literary Archive Foundation are tax
deductible to the full extent permitted by U.S. federal laws and
your state’s laws.

The Foundation’s business office is located at 809 North 1500


West, Salt Lake City, UT 84116, (801) 596-1887. Email contact
links and up to date contact information can be found at the
Foundation’s website and official page at
www.gutenberg.org/contact

Section 4. Information about Donations to


the Project Gutenberg Literary Archive
Foundation
Project Gutenberg™ depends upon and cannot survive without
widespread public support and donations to carry out its mission
of increasing the number of public domain and licensed works
that can be freely distributed in machine-readable form
accessible by the widest array of equipment including outdated
equipment. Many small donations ($1 to $5,000) are particularly
important to maintaining tax exempt status with the IRS.

The Foundation is committed to complying with the laws


regulating charities and charitable donations in all 50 states of
the United States. Compliance requirements are not uniform
and it takes a considerable effort, much paperwork and many
fees to meet and keep up with these requirements. We do not
solicit donations in locations where we have not received written
confirmation of compliance. To SEND DONATIONS or
determine the status of compliance for any particular state visit
www.gutenberg.org/donate.

While we cannot and do not solicit contributions from states


where we have not met the solicitation requirements, we know
of no prohibition against accepting unsolicited donations from
donors in such states who approach us with offers to donate.

International donations are gratefully accepted, but we cannot


make any statements concerning tax treatment of donations
received from outside the United States. U.S. laws alone swamp
our small staff.

Please check the Project Gutenberg web pages for current


donation methods and addresses. Donations are accepted in a
number of other ways including checks, online payments and
credit card donations. To donate, please visit:
www.gutenberg.org/donate.

Section 5. General Information About Project


Gutenberg™ electronic works
Professor Michael S. Hart was the originator of the Project
Gutenberg™ concept of a library of electronic works that could
be freely shared with anyone. For forty years, he produced and

You might also like