(eBook PDF) Fundamentals of C# Programming for Information Systems 2nd Edition download
(eBook PDF) Fundamentals of C# Programming for Information Systems 2nd Edition download
https://ebooksecure.com/product/ebook-pdf-fundamentals-of-c-
programming-for-information-systems-2nd-edition/
http://ebooksecure.com/product/ebook-pdf-fundamentals-of-c-
programming-for-information-systems-2nd-edition-2/
http://ebooksecure.com/product/ebook-pdf-fundamentals-of-
information-systems-9th-edition/
http://ebooksecure.com/product/ebook-pdf-fundamentals-of-
information-systems-8th-edition/
https://ebooksecure.com/download/fundamentals-of-information-
systems-ebook-pdf/
Essentials of MIS (Management Information Systems),
15th Global Edition Kenneth C. Laudon - eBook PDF
https://ebooksecure.com/download/essentials-of-mis-management-
information-systems-15th-global-edition-ebook-pdf/
https://ebooksecure.com/download/essentials-of-mis-management-
information-systems-15th-global-edition-ebook-pdf-2/
http://ebooksecure.com/product/ebook-pdf-management-information-
systems-for-the-information-9th/
https://ebooksecure.com/download/fundamentals-of-ecosystem-
science-ebook-pdf/
http://ebooksecure.com/product/ebook-pdf-fundamentals-of-
communication-systems-global-edition-2nd-edition/
6.5 Getting User Input from Controls ................................................................................................... 183
6.6 Working with ComboBoxes............................................................................................................ 186
6.7 Working with ListBoxes ................................................................................................................. 196
6.8 Windows Presentation Foundation (WPF) ..................................................................................... 201
Exercises ............................................................................................................................................... 203
Chapter 7: Arrays ................................................................................................205
7.1 Introduction to One-Dimensional Arrays ....................................................................................... 205
Tutorial 1: Working with 1-D Arrays: Test Scores Application ........................................................... 208
7.2 Assigning a Value to an Element of an Array................................................................................. 211
7.3 Accessing Elements of an Array Using the Index .......................................................................... 212
7.4 Accessing Elements of an Array Using the foreach Loop .............................................................. 215
7.5 Copying an Array............................................................................................................................ 217
7.6 Looking Up Values in an Array ...................................................................................................... 221
Tutorial 2: Lookup Units Sold Using 1-D Arrays................................................................................. 222
Exercises ............................................................................................................................................... 224
Chapter 8: Sequential Files and Arrays.............................................................226
8.1 Introduction to Text Files................................................................................................................ 226
Tutorial 1: Reading Text Files .............................................................................................................. 229
8.2 Splitting a Row: Split Method ........................................................................................................ 231
8.3 Reading Data from Files into Arrays .............................................................................................. 234
8.4 Additional Methods of Arrays ........................................................................................................ 241
Tutorial 2: Looking Up Phone Numbers Using Arrays ........................................................................ 242
Tutorial 3: Using a ComboBox to Select the Search Name .................................................................. 246
8.5 Writing to Text Files ....................................................................................................................... 248
Tutorial 4: Writing Scores to Text File ................................................................................................. 248
8.6 SaveFileDialog Control .................................................................................................................. 255
8.7 Passing Arrays to Methods ............................................................................................................. 259
Tutorial 5: Passing Arrays to Compute Average .................................................................................. 259
8.8 Two-Dimensional (2-D) Arrays ...................................................................................................... 263
Tutorial 6: 2-D Array to Find the Sales for a Product........................................................................... 267
Exercises ............................................................................................................................................... 271
Rentals Assignment 2 ........................................................................................................................... 272
Help Desk Assignment 2 ...................................................................................................................... 274
Chapter 9: Collections .........................................................................................276
9.1 Introduction to Collections.............................................................................................................. 276
9.2 List<T> Collection .......................................................................................................................... 278
Tutorial 1: Looking Up Sales Data Using a List ................................................................................... 279
9.3 Dictionary<TKey, TValue> Collection .......................................................................................... 285
Tutorial 2: Dictionary with Product# as Key and Price as Value ......................................................... 287
Tutorial 3: Dictionary with Product# as Key and Sales Array as Value ............................................... 293
Exercises ............................................................................................................................................... 297
Chapter 10: Graphical User Interface: Additional Controls...........................298
10.1 ListView: Features ........................................................................................................................ 298
10.2 Adding Items to ListView ............................................................................................................. 299
Tutorial 1: Selecting a Show from a ListView ..................................................................................... 302
10.3 Accessing Data from a ListView .................................................................................................. 302
10.4 Forms with Tab Pages ................................................................................................................... 308
Tutorial 2: Multipage Form with TabControl ....................................................................................... 308
Exercises ............................................................................................................................................... 310
Chapter 11: Multi-form Applications and Menus ............................................312
11.1 Introduction ................................................................................................................................... 312
11.2 Accessing an Existing Form from Another................................................................................... 313
Tutorial 1: Multi-form Financial Planning Application ........................................................................ 315
11.3 Sharing a Method between Multiple Forms .................................................................................. 318
Tutorial 2: Sharing the LoadDictionary Method between Forms ......................................................... 319
11.4 Closing a Parent Form .................................................................................................................. 325
11.5 Menus............................................................................................................................................ 328
11.6 ToolStrips...................................................................................................................................... 332
Exercises ............................................................................................................................................... 334
Chapter 12: Databases .........................................................................................335
12.1 Introduction ................................................................................................................................... 336
12.2 Creating Database Objects ............................................................................................................ 336
Tutorial 1: Display Employee Records Using the Wizard .................................................................... 337
12.3 Displaying Data in a DataGridView ............................................................................................. 340
12.4 Accessing Data Items from a DataGridView ................................................................................ 346
12.5 Displaying Data in Details View .................................................................................................. 349
12.6 Finding the Record for a Selected Key ......................................................................................... 351
Tutorial 2: Find Employee Records Using the Wizard ......................................................................... 352
12.7 Selecting a Group of Records Using the Binding Source ............................................................. 356
12.8 Selecting Records Using the Table Adapter ................................................................................. 362
Tutorial 3: Parameter Query to Select Records..................................................................................... 363
12.9 Untyped Datasets: Displaying Records......................................................................................... 365
Tutorial 4: Display Records Using Untyped Datasets .......................................................................... 366
12.10 Untyped Datasets: Selecting Records ......................................................................................... 375
Tutorial 5: Select Records Using Untyped Datasets ............................................................................. 377
12.11 Untyped Datasets: Add/Edit/Delete Records .............................................................................. 384
Tutorial 6: Add/Edit/Delete Using Untyped Datasets........................................................................... 385
12.12 Command Object and DataReader .............................................................................................. 394
Tutorial 7: SqlCommand and SqlDataReader to Work with Tables ..................................................... 396
Exercises ............................................................................................................................................... 405
Rentals Assignment 3 ........................................................................................................................... 407
Help Desk Assignment 3 ...................................................................................................................... 407
Chapter 13: Object-Oriented Programming .....................................................414
13.1 Introduction to Objects and Classes .............................................................................................. 415
13.2 Classes versus Objects .................................................................................................................. 415
13.3 Information Hiding (Encapsulation) ............................................................................................. 417
Tutorial 1: Create an Employee Class................................................................................................... 419
13.4 Properties ...................................................................................................................................... 423
Tutorial 2: User Interface and Properties .............................................................................................. 426
13.5 Calling Methods (Sending Messages to Objects) ......................................................................... 434
Tutorial 3: Calling Methods and Passing Data between Forms ............................................................ 435
Exercises ............................................................................................................................................... 448
Chapter 14: Inheritance ......................................................................................450
14.1 Introduction to Inheritance ............................................................................................................ 451
14.2 Implementing Inheritance ............................................................................................................. 452
Tutorial 1: Creating Subclasses ............................................................................................................ 454
14.3 Using Subclasses and Super Classes............................................................................................. 458
14.4 Overriding Methods ...................................................................................................................... 459
Tutorial 2: Implementing the GrossPay Method................................................................................... 462
14.5 Polymorphism ............................................................................................................................... 467
Tutorial 3: Dynamic Dispatch and the ToString Method...................................................................... 468
14.6 Abstract Classes and Interfaces..................................................................................................... 472
Tutorial 4: Interfaces ............................................................................................................................. 473
14.7 Using Interfaces to Sort Collections ............................................................................................. 480
Tutorial 5: Sorting Employees .............................................................................................................. 483
14.8 Access Modifiers in C# ................................................................................................................. 486
Exercises ............................................................................................................................................... 488
Chapter 15: Introduction to Web Applications Development .........................491
15.1 Introduction to Web Applications ................................................................................................. 491
15.2 Creating a Single-Page ASP.NET Website................................................................................... 496
Tutorial 1: Developing a Simple Web Page: Ice Cream Cost ............................................................... 496
15.3 Introduction to HTML .................................................................................................................. 502
15.4 Working with Web Server Controls.............................................................................................. 506
15.5 Validating Data Using Validation Controls .................................................................................. 517
Exercises ............................................................................................................................................... 522
Chapter 16: Web Development: Multipage and Database Applications.......523
16.1 Accessing Databases from Web Forms ........................................................................................ 523
Tutorial 1: Accessing a Database: Theater Tickets Application ........................................................... 524
16.2 Preserving Data during Postbacks Using View State ................................................................... 538
16.3: Multipage Websites and Session State ........................................................................................ 543
16.4 Setting a Page to Its Previous State ............................................................................................... 551
Exercises ............................................................................................................................................... 557
Appendix A: Binary Files ....................................................................................559
A.1 Writing to Binary Files .................................................................................................................. 559
Tutorial: Working with Binary Files ..................................................................................................... 559
A.2 Reading Binary Files ...................................................................................................................... 560
Appendix B: Creating a Database ......................................................................562
Tutorial: Creating HR Database............................................................................................................ 562
Appendix C: Answers to Review Questions ......................................................564
Appendix D: HTML Elements ............................................................................584
Index ......................................................................................................................586
Preface
Mission of the Text
Welcome to Fundamentals of C# Programming for Information Systems. This book teaches the
fundamentals of programming in C# to provide a solid foundation to build business and other real-world
applications. Programming concepts are discussed in the context of familiar practical applications that use
graphical interfaces.
Target Audience
This book is designed for introductory programming courses in IS/MIS, CIS and IT. This book also
would fit into a computer science curriculum with an introductory course that uses a GUI-based
application-oriented approach to teach programming concepts. The breadth and depth of coverage makes
this book suitable for a two-course sequence, particularly when students come to the first course with no
programming background and a slower pace is desired. An approach in a two-course sequence would be
to do in-depth coverage of topics like collections, databases, object-oriented programming, web
development, and others presented in later chapters only in the second course.
Key Features
A key feature of the book is that programming concepts are introduced in small chunks through examples
and illustrations accompanied by hands-on tutorials. The tutorials, which are interspersed with the
concepts, help students apply and explore what they learn immediately. Additionally, review questions
and exercises within the chapters enhance student interest and learning.
Although the book is written for beginners, it is thorough and concise. Graphical illustrations and
screenshots are used throughout the book to enhance learning for both beginners and experienced
students.
Windows forms are used from the beginning to provide GUI-based as opposed to console-based interface.
This book builds graphical user interfaces and code in the .Net environment using Visual Studio. You are
encouraged to use the current free version, Visual Studio Community 2017. Earlier versions, including
Visual Studio 2015, Visual Studio Express and Visual Studio 2013, generally work well, except that you
won’t be able to run a few programs that use certain features available only in C# version 7.1 or greater.
ii
Supplements
For Students: Tutorial_Starts.zip file that contains
o Partially completed projects for tutorials
o Data files/databases used in projects
To install Visual Studio, open the downloaded .exe file and run it.
between collections and arrays, collections are presented in this book immediately following Chapter 8 on
arrays.
Chapter 10 discusses the application of ListView and TabControl. The dependency of this chapter on
Chapter 9 (“Collections”) is very low. The prerequisite for this chapter includes Chapters 6 and 8.
Chapter 11 presents multiform applications, Menus and ToolStrips. This chapter has some dependency on
previous chapters, except Chapter 10.
Chapter 12 provides in-depth coverage of accessing databases from C# programs. Chapter 6 is a
prerequisite for this chapter. In addition, the ListView control presented in Chapter 10 is used in an
example in the last part of this chapter, and it is required in the third comprehensive assignment
(Assignment 3) at the end of this chapter. Assignment 3 also requires the use of MainMenu control
discussed in Chapter 11. Other than that, the dependence of Chapter 12 on Chapters 7–11 is relatively
low.
Chapter 13 provides an introduction to object-oriented programming (OOP) principles and techniques.
The initial part of this chapter may be used for an introduction to OOP early in the semester.
Chapter 14 describes the concept of inheritance, implementation of inheritance, subclasses and super
classes, overriding methods and polymorphism. Chapter 13 is a prerequisite for this chapter, and it also
relies on collections from Chapter 9.
Chapter 15 presents the concepts of web applications development, and develops simple web applications
using the ASP.Net platform in the Visual Studio environment. Only the basic programming knowledge
presented in Chapters 1–3 is required for this chapter.
Chaper 16 describes how to access SQL Server databases and develop multipage web projects. Basic
programming concepts presented in Chapters 1–6, the concept of collections from Chapter 9, and basic
database concepts including binding controls to a database and filtering records (Chapter 12) are used in
building the application.
iv
Acknowledgments
I am thankful for the valuable assistance provided by many people in the preparation of this book. I wish
to thank Dr. Jakob Iversen, The University of Wisconsin–Oshkosh, for authoring Chapters 13 and 14 on
Object-Oriented Programming.
I was fortunate to work with Beth Lang Golub, editor and president of Prospect Press, who was flexible
and supportive of my goal to offer a good quality programming textbook at a reasonable price. Special
thanks go to Susan Hegedus, Kathy Bond Borie and Rachel Paul for their painstaking attention to detail in
editing this book, and to Annie Clark for the cover design.
I wish to acknowledge the contributions of the following reviewers for their valuable guidance in
improving the presentation and contents of this book:
Janet Bailey, University of Arkansas at Little Rock
Wei Kian Chen, Champlain College
Clinton Daniel, University of South Florida
Silvana Faja, University of Central Missouri
Joni L. Jones, University of South Florida
David Pumphrey, Colorado Mesa University
Manonita M. Ratwatte, University of Oklahoma (Retired)
Theadora Ross, University of Arkansas at Little Rock
David M. Weber, Northern Arizona University
Thanks are also due to the instructors who provided valuable feedback on the first edition of this book
through user surveys:
Janet Bailey, University of Arkansas, Little Rock
Jeff Dickson, Oregon Institute of Technology
Ruth Lamprecht, Virginia Union University
Panos Linos, Butler University
Ziping Liu, Southeast Missouri State University
Robert Pilgrim, Murray State University
Kris Rosenberg, Oregon Institute of Technology
Doug Titus, University of North Florida
Welcome to programming in C# language. In this chapter, you will learn to develop simple programs in
the Visual Studio development environment, and to work with different types of data.
Learning Objectives
After studying this chapter, you should be able to:
Identify the inputs, processes and outputs of a software system.
Describe the steps involved in developing a computer program.
Describe the terms: syntax, logic and runtime errors, machine language, low-level language, high-
level language, compiler and interpreter.
Develop a simple form in Visual Studio to accept user input, do calculations and display
formatted output.
Work with Label, TextBox, Button, ListBox and MessageBox.
Develop simple programs that use constants, variables and expressions.
Use try-catch method to catch errors.
Topics
Typically, a program uses one or more data items to produce some results. For example, a program that
processes an order might use the item number and order quantity to compute the subtotal, sales tax and
total cost, as represented in Figure 1-1.
Subtotal
Item# Process
Sales tax
Quantity Order
Total cost
The program, represented by the block “Process Order,” may include multiple subtasks like look up the
unit price, check inventory and compute results.
The data that are used by a program are called the input to the program, and the results produced are
called the output of the program. In addition to processing input data to produce the output, a program
might write data to and read data from storage devices like a flash drive or a hard drive, as represented in
Figure 1-2.
Here is an example of a simplified statement of the purpose of the order processing program:
Purpose: Compute and display the subtotal, sales tax and total cost for an order
The output of the program often follows from the purpose. For this example, the output would be
Output: subtotal, sales tax, total cost
The process specifies not only what the program should do (e.g., compute total cost) but also how it
should be done (e.g., how to compute total cost), as follows:
Process: (What?) Look up unit price, look up sales tax rate,
compute subtotal, sales tax and total cost
(How?) subtotal: unit price * order quantity
sales tax: subtotal * sales tax rate
total cost: subtotal + sales tax
Specifying the process also would include identifying the sources of data, like the product file to get the
unit price and sales tax file to get the sales tax rate.
The input specifies the data items that are needed to carry out the process to produce the output. The
input for this order-processing system would be
Input: item number, order quantity
Note that unit price and sales tax rate are not included in the input because the program looks them up. A
real-world system would be a lot more complex. Typically, the process would include additional subtasks
like handling orders when inventory is insufficient, and output may include various reports. In such
systems, graphical methods like Data Flow Diagrams and UML diagrams are used to represent the
processes and the data accessed by them.
Again, a real-world program may have to do additional subtasks, like checking the inventory to make sure
there is sufficient quantity on stock.
For relatively simpler programs, after identifying the subtasks, you may go directly to writing the
program for each subtask. However, for tasks involving more complex logic, it might help to develop an
outline of the logic of performing the subtasks. The representation of the logic of a program in plain
English is called pseudo code. You also may represent the logic graphically using a flowchart, as
discussed in Chapter 3.
source code, to another language before running a program, as described in the next section. So, your
first task is to make sure that there are no syntax errors. The good news is that Visual Studio provides a
lot of help in identifying syntax errors.
After the syntax errors are eliminated, the program may run. But, it’s still too early to celebrate because
the results could be incorrect due to errors in the program logic, just like you can write a grammatically
correct sentence that doesn’t convey the intended message. Errors that cause a program to produce
incorrect or unintended results are called logic errors. A tax-filing software using the wrong tax rate and
a billing software overcharging a customer are examples of logic errors.
There are errors other than logic errors that can occur at runtime. These are called runtime errors.
Runtime errors cause the program to crash (unless the program catches and handles such errors) because
the program asks the computer to do something it is unable to do, like accessing a file with an invalid path
or dividing a number by zero.
The process of identifying errors (bugs) is called debugging. Testing programs to identify and eliminate
errors is an extremely important part of developing software.
Review Questions
1.1 Consider Google as a software system. What would be the input, process and output for Google?
1.2 Consider a software system that enrolls students into classes. Identify some key inputs that the
system needs every time a student enrolls in a class, and the subtasks (process) that need to be
performed. What are some outputs the system should produce for students and instructors?
1.3 List the major steps in developing a program.
1.4 Incorrect punctuation in a program is an example of what type of error?
1.5 A payroll program uses the wrong formula to compute overtime pay. What type of error is it?
1.6 True or false: A program that doesn’t have any syntax errors should produce the correct results.
The products that support developing and running programs within the Visual Studio family include the
following:
1. An Integrated Development Environment (IDE)
An IDE provides an environment to develop programs, which includes code editors for Visual
C#, Visual Basic, Visual J#, Visual C++, HTML and XML, and designers for Windows forms
and web forms.
In Visual Studio, a software application typically is organized into Projects that may contain one
or more forms.
Forms provide the user interface that allows users to input data for the program, to interact with
the program and to display results.
2. A compiler that translates the source code into Microsoft Intermediate Language (MSIL)
Running a program, as described earlier, consists of (1) the compiler translating the source code (the
project) into Microsoft Intermediate Language Assembly and (2) the Common Language Runtime
translating the assemblies from Intermediate Language to Machine Language and executing the program
to produce the output. Next, we will look at how to work with Visual Studio to develop C# programs.
Review Questions
1.7 What is the only programming language that the CPU can understand?
1.8 What is a compiler?
1.9 What is an interpreter?
1.10 What is Microsoft Intermediate Language Assembly?
1.11 What is the function of Common Language Runtime in Visual Studio?
Figure 1-4 presents the design of the form that shows the user interface to let the user enter the number of
scoops and unit price to display the cost. You will create the form in Tutorial 1.
You may change the color theme by selecting Environment, General from the Options window.
Similarly, you may reset your settings by selecting Tools, Import and Export Settings, Reset all
Settings.
Close Options window.
Select Visual C# from Templates, Other Languages. For the type of application, select Windows
Forms Application, as shown in Figure 1-6.
For Name, enter Ch1_IntroProgramming.
Select the Location, if different from the default folder.
Leave the CheckBox for Create directory for solution unchecked so that both the Project and the
Solution will be created in the same folder. (If there are multiple Projects within a Solution, it
would be better to have separate directories for the Solution and Projects.) Note that the default
name for the Solution is the same as that of the Project.) Click OK.
The Visual Studio development environment appears, as shown in Figure 1-7.
“Marry him! She may thank her stars she got him. Let them talk as
much as they like about his being a harum-scarum fellow. There’s
not a smarter, better-hearted fellow in this place, nor a man of
better judgment. He showed a good deal more sense than our Ben,
who, folks think, is all sense.”
“How, father?”
“Why, Ben built his house, and then set his fire, and liked to have
burned up his house, baby, and all the lumber that went into his
vessel, and did scorch his wife; but this harum-scarum fellow burnt
his land over first, and put something in the ground to live on.”
“They say,” said Mrs. Rhines, “that they are the most affectionate
pair that ever was. Joe thinks there is not her equal in the world.”
“That’s just what he ought to think, wife. I hope it will last, and not
be with them as it was with Joe Gubtail and his Dorcas.”
“Why, he said, when they were first married, he loved her so well he
wanted to eat her up, and now he wishes he had.”
“I don’t think it will, for they have been fond of each other since
they were children, and ought to be well acquainted.”
“You haven’t said anything about Flour, Captain Rhines,” said Charlie.
“O, he ain’t Flour any longer. He lives in a frame house on his own
land, is Mr. Peterson, has money at interest, can read, write, and
cipher, and is master-calker at Wiscasset.”
“Good! Won’t we go over and see him? Didn’t they cut up some
rusties on Joe when he was married?”
“No.”
“I should have thought the boys would have done something to him
to pay him up for all his tricks, for there’s hardly anybody in town
but has something laid up against him.”
“So should I,” said John. “I should have thought they would have
given him a house-warming, and paid up old scores.”
“One was, that everybody loves and respects his wife; another, that
Joe had been very quiet for a long time before he was married, and
they didn’t quite like to stir him up again, for fear they might get the
worst of it, get into a bear-trap, or he might fire a charge of peas or
salt into them. Joe Griffin isn’t a very safe fellow to stir up.”
“That’s it.”
“Isaac Murch?”
“Yes.”
“And has come back mate,” said the captain.
“Where is he?”
“In Boston; but he’s coming home to stay some time. They’re going
to heave the vessel out, recalk, and overhaul her thoroughly.”
“Here we are, all together again,” said John, thrusting his chair
between Charlie and Fred, and taking a hand of each, while Tige,
who could bear “no rival near the throne,” put his nose in John’s lap.
“Now,” said Mrs. Rhines, “we have answered all your questions, and
told you all the news, we should like to have you tell us some; and
first, why did you come afoot? You wrote us you was coming by
water. What has become of the boat, Charlie?”
“Sold her to Mr. Foss. Just before we were going to start, he offered
me twenty-five dollars for her. I asked John what he thought about
it. He said, sell her; ’twould be a great deal better fun to come
through the woods, and camp out; that sailing was nothing new to
us. So we put our things aboard a coaster, took our packs, and
started.”
“And you had rather go through all that than come comfortably in
the summer time, with a fair wind, in a good boat?”
“Yes, father; we had a first-rate time. I can tell you they are going
ahead in Portland, building vessels at a great rate. Congress has
granted money to finish the light on Portland Head, and it’s almost
done.”
“They’ve got wagons and sleighs there,” said Charlie. “They don’t
ride altogether on horseback as they do here. In one of these
wagons a farmer can carry a whole ox, or three or four calves; carry
a barrel of molasses, and two folks ride besides; or eight or ten
bushels of potatoes, and whole firkins of butter. They don’t have to
carry a little, stuck in saddle-bags.”
“They’ve got a wagon with two horses, that carries the mails and
passengers to Portsmouth, to meet the Boston stage. They’ve got
chaises, lots of them. All the ministers have them; and there’s a
man, just come there from Newburyport, that’s going to make
chaises.”
“Captain Rhines,” said Charlie, “there are big Spanish and English
ships come there after spars.”
“I guess it is. Everybody that lives there says it can’t help being a
great place. They are expecting it will be an awful big place; and
there’s a company getting up to build a wharf clear to the channel,—
O, I don’t dare to tell how long!—with stores on it. They’re going to
call it Union Wharf.”
“Father,” said John, “a man came there lately who wears loose
breeches that come clear to his shoes. They call ’em pantaloons.
Captain Starrett says it’s because he’s spindle-shanked, and wants to
cover his legs up.”
In the course of the afternoon, Captain Rhines put the saddle on the
horse, and sent Elizabeth over to Uncle Isaac’s; and when she
returned, both he and his wife came with her.
“Charlie,” said Captain Rhines, “in the morning you and John must
go and see old Mrs. Yelf.”
“You must see her, because the poor old lady won’t live long, and
she longs to see you. It will take but a few minutes to go over in the
morning, and then John can set you on to the island.”
CHAPTER VII.
CHARLIE AT HOME AGAIN.
The next morning, after making their call upon Mrs. Yelf, greatly to
the old lady’s satisfaction, they started for Elm Island.
Ben and Sally, having been informed by Captain Rhines of the time
at which the boys would start, and of the manner in which they
expected to come, were equally, with him, eagerly expecting their
arrival.
Many times she left her work during the day, and went to the door
to see if they were coming. During the period that had elapsed since
the brief but glorious career of the West Wind, the old dugouts had
either passed into oblivion, or were debased to mere tenders for the
whaleboats, which were kept afloat at their moorings, or even used
as cars (cages) to keep lobsters and clams alive in. Whaleboats had
also increased in numbers, by reason of the impulse given to fishing,
and were frequently seen going to and fro in good weather; and
Bennie, who took every sail, it mattered not in what direction they
were heading, for the Perseverance, Jr., kept his mother in a
constant state of excitement by running into the house, and bawling
out, “Marm, they’re coming! They’re most here!” Ben also frequently,
in the course of the day, swept the horizon with his spy-glass. They
expected the boys would land at Captain Rhines’s first, stop all night,
and then John come over with Charlie. Accordingly he frequently
inspected the cove, and the adjacent shores, and if he manifested
less outward show of interest than his father, it must be attributed to
his sluggish temperament, which was less easily roused, and the fact
that he had more to occupy him, and was just at that time engaged
with his hired man upon a job that interested him exceedingly. He
was at work in his orchard.
When Ben declared that he would make cider yet on Elm Island, it
was no idle boast. He had gone to work in the best possible way to
accomplish his designs. He had, in the first place, burned the land
over, the same season in which the growth was cut, and before it
was dry, on purpose that the fire should not burn too deep, and
consume the vegetable mould down to a barren subsoil. The growth
of wood was also of a kind that was rich in potash, an element in
which the apple, of all the trees of the field, delights. Instead of
waiting till he had taken several crops from the land, the stumps had
decayed, and it was exhausted by many ploughings and plantings,
he set out three hundred grafted trees, of choice fruit, that Mr.
Welch had given him, right in the ashes, and among the stumps.
Wherever a stump interfered with the regularity of the rows, he dug
it up, otherwise set the tree close beside it, and the young tree fed
upon its decaying roots. In addition to this, the soil was filled with
the excrements of sea-fowl, that for centuries had bred upon the
island, and it was abundantly supplied with lime from the shells of
muscles, cockles, and bones of fish with which they fed their young.
He was now engaged in burning the weeds and brush, which had
been previously cut and piled up, intending to scatter the ashes
around the roots of the young trees. He was also removing the
stumps, a sharp drought proving very favorable to his operations.
There were a few pine stumps on the piece, which, when not too
near an apple tree, were set on fire, and completely exterminated,
the fire following the roots into the dry soil, and living there
sometimes for weeks.
Since the stump-pulling had commenced, and the fires been started,
Bennie, having changed his playground from the green before the
front door, which commanded a full view of the bay, to the orchard,
was busily employed roasting clams by a fire made under a pine
stump; Sailor was helping him, the cat patiently waiting for her
share of the repast, the baby asleep in the cradle, and Sally busy
getting dinner. Aided by all these circumstances, the boys entered
the cove unperceived, and with all the caution of whalemen
approaching a slumbering whale.
The doors were all open, for it was a warm day. Slipping off their
shoes, they passed on to the kitchen. Sally was frying fish in the
Dutch oven, and talking to herself all the while.
“I don’t see what has got those boys: they ought to have been here
a week ago. Here I, and all of us, have been watching, and I have
been cooking, to have something nice for them when they come.
There are the custards, that John likes so well, as sour as swill; the
cake all mouldy, and the chicken pie soon will be. Charlie likes warm
biscuit so well, I thought we should see them when they got to the
other shore, and then I should have time to bake some, and have
them piping hot when they get here; now I don’t know what to do.
There’s that mongrel goose, the first one we have ever killed, Charlie
thought so much of them, and took so much pains to raise them, I
did mean he should help eat the first one. O dear, I wish I hadn’t
killed it; but now it’s killed and cooked we must eat it, or it will spoil;
Charlie ain’t here, nor like to be.”
“How you started me, you roguish boy, you and John too. Why boys,
where have you been? We’ve been looking more than a week, with
all the eyes in our heads, and you’ve come at last, just as we had
given up.”
“One your father built the year after you went away.”
“I’m right glad, for I’ve sold mine in Portland, and was afraid I
shouldn’t have any to sail in. Whose scow is that?”
“Where is father?”
“Why, how you’ve grown, you dear child!” cried Charlie, catching
Bennie up in his arms, who came running to meet them.
“I should think somebody else had grown too,” said Ben, taking
them both up, setting Charlie astride one of the near oxen’s back,
with the child in his arms; “but I believe John has grown the most,”
putting his arm around him, with an appearance of great affection.
“What a noble team you’ve got, Ben; are these the same cattle you
had when we went away?”
“Yes, all but them sparked ones on forward; they are twins, and are
seven feet and a half. I went clear to North Yarmouth after them,
and I never have dared to tell how much I gave for them. I’ve never
asked them to do anything yet, but what they’ve done it: that yoke
ain’t fit for them, it’s too narrow between the bow holes, and hauls
upon their necks. Charlie you must make me one.”
“I will, father, I’ll make one that will fit them. But how these apple
trees have grown, I couldn’t have believed it possible.”
“Ah, Charlie, what do you think now about making cider on Elm
Island? In three years more some of these largest apple trees will
begin to bear, and one of these in the garden, that Uncle Isaac gave
you, blossomed last spring.”
“How does the goose go, Charlie?” asked Sally, when they were well
entered upon the repast.
“Never tasted anything better in my life,” said he, speaking with his
mouth full.
“I must go now,” said John, when the meal was ended; “I promised
father I wouldn’t stop.”
“No, you won’t go,” said Sally, “till after supper. I baked some
custards for you, and kept them till they were sour. You can’t go till I
bake some more; so it’s no use to talk.”
“We’ll have supper early,” said Ben, “and you can get home before
dark.”
They spent the time till supper in social chat, and in looking at the
crops and improvements that had been made on the island.
Charlie found the swallows had multiplied amazingly, the eaves and
rafters of the barn being filled with long rows of nests.
“We haven’t many,” replied Ben; “we’ve been saving them till you
came.”
“Well Charlie,” said he, as they stood at the shore looking after John,
as he departed, “I suppose Elm Island seems rather a dull place, and
a small affair, after being in such a great place as Portland.”
“Not till that orchard is done. I want to drive those oxen. O, father,
won’t we have a good time burning the stumps, putting the ashes
round the trees, making it look neat and nice, and picking up all the
stones?”
“I see,” replied Ben, “you have brought back the same heart you
carried away.”
“Why, father, how could I go right off, when you have got so much
to do, and it is such a nice time to do it? Besides, I haven’t seen the
maple, nor been up in the big pine; and I’ve only just looked over
the fowl, and haven’t taken particular notice of any of them, nor of
the birds; then there’s a leg gone out of mother’s wash-bench, a
latch off the kitchen door, a square of glass broke in the buttery, and
that yoke to be made, and the piece must be cut and put to season.
You must have a better goad, father; it’s a shame to drive such a
team with a beech limb. There’s a tough little white-oak butt, as blue
as a whetstone, in the shop, that Uncle Isaac gave me: I’ll make a
goad of that. Then I mean to make a pair of cart wheels, such as I
saw in Portland, on the Saccarappa teams, and John says he’ll put
tires on them. Why shouldn’t we have things on Elm Island as well
as they up there.”
“If you’re going to do all that, or half of it, you wont get off the
island this month.”
“I don’t know as I shall do it all now, but I’ll begin, and I’ll make the
goad before it’s time to go to work to-morrow. Come, father, let us
go and split up the butt before dark.”
They took the small oak butt, set it on end, Charlie held the axe to
the end of it, Ben struck the pole of the axe with a piece of wood,
and they split it in halves, saved one half for axe handles, and split
the other up fine for goads. Charlie was up betimes in the morning,
made a beautiful goad, scraped it with glass, then rubbed it with
dogfish skin, oiled it, and put a brad in it. It was tough as leather. He
made another for Bennie, Jr. Proudly the little chap strutted beside
Charlie with his goad, kindled fires, heaped the brush and roots on
them, roasted clams, baked potatoes in an oven Charlie made for
him, and blessed his stars that Charlie had come.
Before two days Charlie had cut down an elm, roughed out a yoke,
bored the bow-holes, and put it up in the smoke-hole to season, to
be smoothed by and by. He counted sixteen partridges among the
yellow birches, but by Ben’s advice abstained from killing any till
they should have increased in numbers.
“Let them alone, and give them a chance to lay and breed another
spring and summer,” said Ben, “and then we can shoot as many as
we want to eat, and they will hold their own.”
CHAPTER VIII.
JOE GRIFFIN AT HOUSEKEEPING.
When Ben, Jr. received his goad, made as smooth as glass and fish-
skin could render it, oiled with linseed oil to give it a handsome color
and make it more pliable, he was highly gratified. The youngster,
however, soon ascertained that in one very important respect it was
deficient: there was no brad in it.
For a while he amused himself by sticking the brad into chips and
flinging them to a distance, or impaling wood-worms and
grasshoppers; but these amusements soon ceased to be exciting.
The little Mischief longed, but didn’t quite dare, to try it on the oxen;
he at length determined to do or die. Watching his opportunity when
Charlie’s back was turned, he set his teeth, went close to old Turk,
shut both eyes, and jabbed the brad into his thigh the whole length,
with such good will that the blood followed the steel. All around the
scene of labor were great stumps which had been torn from the
ground, some of the pines ten or fifteen feet in circumference,
sitting on their edges, the sharp points of their roots protruding in all
directions. The enraged ox administered a kick that sent Bennie
through a thorn bush, in amongst the jagged roots of a pine stump,
where he was wedged in fast, screaming piteously. There was,
indeed, abundant cause for lamentation; the thorns had torn his
hands and the side of his face, the point of a pine root had gone
through his upper lip, and the skin was scraped from his thigh.
When Saturday evening came, Sally said to him, “Now, Charlie, not
another stroke of work shall you do till you’ve been to see Uncle
Isaac, Joe Griffin, and the rest of your friends. Here you’ve been
away going on two years, and come home for a visit, and stick right
down to work the very next day. It’s too bad. Uncle Isaac will think
you don’t care anything about him. I should think you’d want to go
to Pleasant Cove.”
“So I do, mother; but you know father has been alone a great part
of the time, and I wanted to help fix the orchard, get the stuff
sawed out for the wheels, and then I’m going to get Uncle Isaac to
help me make them.”
“I will, mother.”
John and Charlie went over to Uncle Isaac’s and staid two days and
nights. There they learned that Isaac, his nephew, was expected
that week. From there they went to Joe Griffin’s. His farm was
situated on a ridge of excellent land that rose gradually from the
water, the summit being covered with a mixed growth, in which
beech largely predominated, succeeded on the declivity by rock
maple, ash, and yellow birch. In front of the house was a cove, with
a point on the south-west side, which sheltered it from winds
blowing from that direction, but was exposed to the north and north-
west winds. The house itself stood within a stone’s throw of the
shore, in the middle of a clearing of about six acres. It was a log
house, of the rudest kind, as Joe thought it very likely he might burn
it up before he got done setting fires. Rude as was its appearance,
the whole scene presented to the eye an aspect of comfort and
plenty. The burn had a noble log fence around it; a magnificent
piece of corn completely surrounded the house and log barn,
growing to the very threshold, leaving only a footpath by which to
reach the house; on the other side, the lot had been sown with
wheat, which was now cut, and large stooks were scattered over the
field.
“Look at the grain,” said Charlie, “don’t that look rich? Well, they’ll
have enough to eat, that’s certain.”
Entering the house, they found Mrs. Griffin at the loom, weaving,
and received a most cordial welcome. The house had but two rooms,
but the roof being sharp, and the house large on the ground, there
was room to put beds in the garret. Skeins of linen and woollen
yarn, hanging up all around the room, attested Sally’s capabilities.
“In the woods, on the back end of the lot, falling trees. He goes into
the woods as soon as he can see, and stays as long as he can see.”
“He must make an awful hole in the woods in a week,” said John.
“No; but the cow does first-rate on browse, and what grass grows
on open spots in the woods. Now Joe gives her cornstalks, she does
better than our cows ever did at home in the best pasture.”
“Yes, a real nice one. Come, go look at him. We’ve had milk enough
for him till lately. Now Joe has to buy potatoes for him; but we shall
have corn enough of our own by and by.”
“That you will,” said John. “I don’t see how you get your cow into
the barn. You can’t drive her through this cornfield; it’s all around
the barn.”
“I guess we do, John. We work hard, but we are well and strong:
work don’t hurt us, and we’ve enough to eat. Our place is paid for.
There ain’t a man in the world has a right to ask Joe for a dollar, and
there never was a woman had a better husband. We are just as
happy as the days are long.”
After seeing the pig and hens, the boys said they must go and find
Joe.
“Well, go right to the end of the corn, and you’ll hear his axe. Do
you like coot stew, boys?”
“Don’t we!” said Charlie; “and haven’t had one since we left home.”
“Then you shall have one for supper. Joe shot some coots this
morning.”
The boys proceeded through the woods, guided by the sound of the
axe, and soon perceived their friend through the trees busily at
work. Creeping cautiously on their hands and knees, they succeeded
in approaching within a stone’s throw, and concealing themselves
behind the roots of an upturned tree, observed his movements. For
a long distance in front of him were trees cut partly through, the
white chips covering the ground all around their roots. He was now
at work upon an enormous red oak, with long, branching limbs.
Having finished his scarf on the side next to some partially cut trees,
and which had taken the tree nearly off, he wiped the sweat from
his brow, and with an upward glance at the sun, leaned upon his
axe-handle.
It was evident to the boys that Joe had been chopping trees partly
off during the whole afternoon, and was about to fall the monster
oak on them, in order to make a drive; and as he knew by the sun it
was not far from supper-time, this was the last he intended to cut
before supper. He had evidently done a hard day’s work. The sweat
was dropping from his nose, and his clothes were saturated.
Nevertheless, a smile passed over his features, as he stood with a
foot on one of the great spur roots of his victim, leaning forward
upon the axe-handle, evidently in a very happy frame of mind.
“Didn’t you see him looking at the sun? He’s glad it’s most supper-
time, when he can see Sally.”
Joe now resumed his work, and taking hold of the end of his axe-
handle with both hands, delivered long, swinging blows, with the
precision and rapidity of some engine, while the great chips fell from
the scarf, and accumulated in a pile around the roots.
“I told you he wanted to see Sally. Only see that axe go in! How true
he strikes, and what a long-winded creature he is!”
“Won’t that make a smashing when it falls? Such a big tree, and
such long limbs! There it goes! I can see the top quiver!”
Crack! snap! Joe ceased to strike as the enormous bulk tottered for
a moment in the air, then falling upon the trees adjoining, which
were cut nearly off, bore them down in an instant, these in their turn
falling upon others. Beneath this tremendous aggregate of forces,
the forest fell with a roar and crash, as though uprooted by a
whirlwind, the air was filled with branches and leaves, and when the
tumult had subsided, a long, broad path was cut through the dense
forest, with here and there a mutilated stub standing upright amid
the desolation. As the last tree touched the earth, a loud cheer,
mingled with the sound of cracking timber and rending branches.
Turning suddenly around, Joe confronted John and Charlie.
“I’m right glad to see you, boys, and take it real kind in you to come
clear up here to visit me. When did you get home?”
“Last week,” said Charlie. “We came over to Uncle Isaac’s, and from
there here. You’ve got a real nice place, Joe. How much land have
you?”
ebooksecure.com