Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
100% found this document useful (12 votes)
99 views

PDF C Programming From Problem Analysis To Program Design 5th Edition Barbara Doyle Download

ebook

Uploaded by

kaljocupi
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (12 votes)
99 views

PDF C Programming From Problem Analysis To Program Design 5th Edition Barbara Doyle Download

ebook

Uploaded by

kaljocupi
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 84

Full download ebook at ebookname.

com

C Programming From Problem Analysis to Program


Design 5th Edition Barbara Doyle

https://ebookname.com/product/c-programming-from-problem-
analysis-to-program-design-5th-edition-barbara-doyle/

OR CLICK BUTTON

DOWLOAD NOW

Download more ebook from https://ebookname.com


More products digital (pdf, epub, mobi) instant
download maybe you interests ...

C Programming From Problem Analysis to Program Design


2nd Edition Barbara Doyle

https://ebookname.com/product/c-programming-from-problem-
analysis-to-program-design-2nd-edition-barbara-doyle/

C Programming From Problem Analysis to Program Design


6th Edition D. S. Malik

https://ebookname.com/product/c-programming-from-problem-
analysis-to-program-design-6th-edition-d-s-malik/

C Programming Program Design Including Data Structures


Fourth edition D. S. Malik

https://ebookname.com/product/c-programming-program-design-
including-data-structures-fourth-edition-d-s-malik/

Programming problem solving abstraction with C Moffat

https://ebookname.com/product/programming-problem-solving-
abstraction-with-c-moffat/
C How to Program Introducing Web Programming with CGI
and Object Oriented Design with the UML 4th Edition
Harvey Deitel

https://ebookname.com/product/c-how-to-program-introducing-web-
programming-with-cgi-and-object-oriented-design-with-the-uml-4th-
edition-harvey-deitel/

Systematic Program Design From Clarity to Efficiency


1st Edition Yanhong Annie Liu

https://ebookname.com/product/systematic-program-design-from-
clarity-to-efficiency-1st-edition-yanhong-annie-liu/

Programming C Sharp 3 0 5th Edition Jesse Liberty

https://ebookname.com/product/programming-c-sharp-3-0-5th-
edition-jesse-liberty/

C how to program Seventh Edition. Edition Deitel

https://ebookname.com/product/c-how-to-program-seventh-edition-
edition-deitel/

C How to Program 8th Edition Paul Deitel

https://ebookname.com/product/c-how-to-program-8th-edition-paul-
deitel/
C# PROGRAMMING:
FROM PROBLEM ANALYSIS TO PROGRAM DESIGN

FIFTH EDITION

Copyright 2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
Copyright 2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
C# PROGRAMMING:
FROM PROBLEM ANALYSIS TO PROGRAM DESIGN

FIFTH EDITION

BARBARA DOYLE

"VTUSBMJBt#SB[JMt+BQBOt,PSFBt.FYJDPt4JOHBQPSFt4QBJOt6OJUFE,JOHEPNt6OJUFE4UBUFT

Copyright 2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
This is an electronic version of the print textbook. Due to electronic rights restrictions, some third party content may be suppressed. Editorial
review has deemed that any suppressed content does not materially affect the overall learning experience. The publisher reserves the right to
remove content from this title at any time if subsequent rights restrictions require it. For valuable information on pricing, previous
editions, changes to current editions, and alternate formats, please visit www.cengage.com/highered to search by
ISBN#, author, title, or keyword for materials in your areas of interest.

Important Notice: Media content referenced within the product description or the product text may not be available in the eBook version.

Copyright 2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
C# Programming: From Problem Analysis to © 2016, 2014 Cengage Learning
Program Design, Fifth Edition WCN: 02-200-203
Barbara Doyle
ALL RIGHTS RESERVED. No part of this work covered by the
copyright herein may be reproduced, transmitted, stored, or used
Product Director: Kathleen McMahon
in any form or by any means graphic, electronic, or mechanical,
Product Team Manager: Kristin McNary including but not limited to photocopying, recording, scanning,
Senior Product Manager: Jim Gish digitizing, taping, Web distribution, information networks, or
information storage and retrieval systems, except as permitted
Senior Content Developer: Alyssa Pratt
under Section 107 or 108 of the 1976 United States Copyright Act,
Product Assistant: Abigail Pufpaff without the prior written permission of the publisher.
Marketing Manager: Eric LaScola Microsoft ® is a registered trademark of the Microsoft
Senior Production Director: Wendy Troeger Corporation.
Production Director: Patty Stephan Unless otherwise noted all screenshots are courtesy of Microsoft
Corporation
Senior Content Project Manager: Jennifer
K. Feltri-George Unless otherwise noted all tables/figures exhibits are
© Cengage Learning®
Managing Art Director: Jack Pendleton
Cover image: © zeljkodan/Shutterstock.com
Production Service: SPi Global For product information and technology assistance, contact us at
Cengage Learning Customer & Sales Support, 1-800-354-9706
Compositor: SPi Global
For permission to use material from this text or product,
submit all requests online at www.cengage.com/permissions.
Further permissions questions can be e-mailed to
permissionrequest@cengage.com

Library of Congress Control Number: 2015937761


ISBN: 978-1-285-85687-2

Cengage Learning
20 Channel Center Street
Boston, MA 02210
USA

Cengage Learning is a leading provider of customized learning


solutions with employees residing in nearly 40 different countries
and sales in more than 125 countries around the world. Find your
local representative at www.cengage.com.
Cengage Learning products are represented in Canada by Nelson
Education, Ltd.
To learn more about Cengage Learning, visit www.cengage.com
Purchase any of our products at your local college store or at our
preferred online store www.cengagebrain.com
Notice to the Reader
Publisher does not warrant or guarantee any of the products described
herein or perform any independent analysis in connection with any of the
product information contained herein. Publisher does not assume, and
expressly disclaims, any obligation to obtain and include information other
than that provided to it by the manufacturer. The reader is expressly warned
to consider and adopt all safety precautions that might be indicated by the
activities described herein and to avoid all potential hazards. By following
the instructions contained herein, the reader willingly assumes all risks in
connection with such instructions. The publisher makes no representations or
warranties of any kind, including but not limited to, the warranties of fitness
for particular purpose or merchantability, nor are any such representations
implied with respect to the material set forth herein, and the publisher takes
Printed in the United States of America no responsibility with respect to such material. The publisher shall not be
liable for any special, consequential, or exemplary damages resulting, in
Print Number: 01 Print Year: 2015 whole or part, from the readers’ use of, or reliance upon, this material.

Copyright 2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
BRIEF CONTENTS

© zeljkodan/Shutterstock.com

PREFACE xxiii

1. Introduction to Computing and Application Development 1

2. Data Types and Expressions 71

3. Methods and Behaviors 137

4. Creating Your Own Classes 197

5. Making Decisions 257

6. Repeating Instructions 325

7. Arrays 399

8. Advanced Collections 459

9. Introduction to Windows Programming 513

10. Programming Based on Events 593

11. Advanced Object-Oriented Programming Features 699

12. Debugging and Handling Exceptions 785

13. Working with Files 849

14. Working with Databases 907

15. Web-Based Applications 993

APPENDIX A Visual Studio Configuration 1089

APPENDIX B Code Editor Tools 1107

Copyright 2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
vi | C# Programming: From Problem Analysis to Program Design, Fifth Edition

APPENDIX C Character Sets 1123

APPENDIX D Operator Precedence 1125

APPENDIX E C# Keywords 1127

GLOSSARY 1129

INDEX 1143

Copyright 2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
TABLE OF CONTENTS

© zeljkodan/Shutterstock.com

Preface xxiii

INTRODUCTION TO COMPUTING
1 AND APPLICATION DEVELOPMENT 1
History of Computers 2
System and Application Software 4
System Software 5
Application Software 7
Software Development Process 7
Steps in the Program Development Process 8
Programming Methodologies 15
Structured Procedural Programming 15
Object-Oriented Programming 18
Evolution of C# and .NET 21
Programming Languages 21
.NET 23
Why C#? 25
Types of Applications Developed with C# 26
Web Applications 27
Windows Applications 28
Console Applications 28
Exploring the First C# Program 29
Elements of a C# Program 30
Comments 30
Inline Comments 31
Multiline Comments 31

Copyright 2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
viii | C# Programming: From Problem Analysis to Program Design, Fifth Edition

XML Documentation Comments 32


Using Directive 32
Namespace 35
Class Definition 36
Main( ) Method 36
Method Body Statements 38
Compiling, Building, and Running an Application 42
Typing Your Program Statements 42
Compilation and Execution Process 42
Compiling the Source Code Using Visual Studio IDE 43
Debugging an Application 50
Syntax Errors 50
Run-time Errors 51
Creating an Application 52
Coding Standards 57
Pseudocode 57
Resources 58
Quick Review 59
Exercises 61
Programming Exercises 66

DATA TYPES AND EXPRESSIONS 71


2 Data Representation 72
Bits 72
Bytes 72
Binary Numbering System 72
Character Sets 75
Kilobyte, Megabyte, Gigabyte, Terabyte, Petabyte. . . 76
Memory Locations for Data 76
Identifiers 77
Variables 81
Literal Values 81

Copyright 2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
Table of Contents | ix

Types, Classes, and Objects 82


Types 82
Classes 83
Objects 84
Predefined Data Types 85
Value Types 86
Integral Data Types 87
Floating-Point Types 90
Decimal Types 91
Boolean Variables 92
Declaring Strings 93
Making Data Constant 94
Assignment Statements 94
Basic Arithmetic Operations 98
Increment and Decrement Operations 100
Compound Operations 104
Order of Operations 106
Mixed Expressions 108
Casts 109
Formatting Output 110
Width Specifier 115
Coding Standards 125
Naming Conventions 125
Spacing Conventions 126
Declaration Conventions 127
Resources 127
Quick Review 127
Exercises 128
Programming Exercises 134

METHODS AND BEHAVIORS 137


3 Anatomy of a Method 138
Modifiers 140
Static Modifier 141
Return Type 142

Copyright 2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
x | C# Programming: From Problem Analysis to Program Design, Fifth Edition

Method Name 144


Parameters 144
Method Body 145
Calling Class Methods 146
Predefined Methods 148
Write( ) Method 149
WriteLine( ) Method 150
Read( ) Method 151
ReadLine( ) Method 153
ReadKey( ) Method 154
Parse( ) Method 154
Methods in the Math Class 157
Writing Your Own Class Methods 163
Void Methods 163
Value-Returning Method 165
Types of Parameters 170
Named and Optional Parameters 175
Default Values with Optional Parameters 176
Named Parameters 177
Coding Standards 186
Naming Conventions 186
Spacing Conventions 186
Declaration Conventions 186
Commenting Conventions 187
Resources 187
Quick Review 187
Exercises 188
Programming Exercises 195

CREATING YOUR OWN CLASSES 197


4 The Object Concept 198
Private Member Data 200
Constructor 204

Copyright 2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
Table of Contents | xi

Writing Your Own Instance Methods 207


Accessor 208
Mutators 208
Other Instance Methods 209
Property 210
Auto Implemented Properties 212
ToString( ) Method 213
Calling Instance Methods 215
Calling the Constructor 215
Calling Accessor and Mutator Methods 217
Calling Other Instance Methods 218
Testing Your New Class 219
Coding Standards 244
Naming Conventions 244
Classes 244
Properties 244
Methods 245
Constructor Guidelines 245
Spacing Conventions 245
Resources 245
Quick Review 246
Exercises 247
Programming Exercises 253

MAKING DECISIONS 257


5 Boolean Expressions 258
Boolean Results 258
Conditional Expressions 259
Equality, Relational, and Logical Tests 260
Short-Circuit Evaluation 268
Boolean Data Type 270
if. . .else Selection Statements 271
One-Way if Statement 271

Copyright 2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
xii | C# Programming: From Problem Analysis to Program Design, Fifth Edition

Two-Way if Statement 276


TryParse( ) Method 278
Nested if. . .else Statement 283
Switch Selection Statements 289
Ternary Conditional Operator ? : 294
Order of Operations 295
Coding Standards 309
Guidelines for Placement of Curly Braces 309
Guidelines for Placement of else with Nested if Statements 310
Guidelines for Use of White Space with a Switch Statement 310
Spacing Conventions 311
Advanced Selection Statement Suggestions 311
Resources 311
Quick Review 312
Exercises 314
Programming Exercises 322

REPEATING INSTRUCTIONS 325


6 Why Use a Loop? 326
Using the While Statement 326
Counter-Controlled Loop 328
Sentinel-Controlled Loop 334
State-Controlled Loops 345
Using the for Statement Loop 348
Using the Foreach Statement 356
Using the Do. . .while Structure 357
Nested Loops 360
Recursive Calls 365
Unconditional Transfer of Control 368
Continue Statement 369
Deciding Which Loop to Use 370
Coding Standards 384
Guidelines for Placement of Curly Braces 385
Spacing Conventions 385
Advanced Loop Statement Suggestions 385

Copyright 2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
Table of Contents | xiii

Resources 386
Quick Review 386
Exercises 388
Programming Exercises 394

ARRAYS 399
7 Array Basics 400
Array Declaration 401
Array Initializers 404
Array Access 406
Sentinel-Controlled Access 411
Using Foreach with Arrays 412
Array Class 413
Arrays as Method Parameters 419
Pass by Reference 420
Array Assignment 423
Params Parameters 425
Arrays in Classes 426
Array of User-Defined Objects 428
Arrays as Return Types 429
Coding Standards 447
Guidelines for Naming Arrays 447
Advanced Array Suggestions 447
Resources 447
Quick Review 447
Exercises 448
Programming Exercises 455

ADVANCED COLLECTIONS 459


8 Two-Dimensional Arrays 460
Rectangular Array 460
Jagged Array 470
Multidimensional Arrays 470
ArrayList Class 475
String Class 479

Copyright 2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
xiv | C# Programming: From Problem Analysis to Program Design, Fifth Edition

String Methods 480


String Interpolation 484
Other Collection Classes 486
BitArray 486
Hashtable 487
Queue 490
Stack 491
Coding Standards 500
Guidelines for Naming Collections 500
Advanced Array Suggestions 500
Resources 500
Quick Review 500
Exercises 502
Programming Exercises 509

INTRODUCTION TO WINDOWS PROGRAMMING 513


9 Contrasting Windows and Console Applications 514
Graphical User Interfaces 516
Elements of Good Design 520
Consistency 520
Alignment 521
Avoid Clutter 521
Color 521
Target Audience 521
Using C# and Visual Studio to Create Windows-Based Applications 522
Windows Forms 526
Windows Forms Properties 526
Inspecting the Code Generated by Visual Studio 533
Comparing the Code of Example 9-1 with Example 9-2 534
Windows Forms Events 537
Controls 538
Placing, Moving, Resizing, and Deleting Control Objects 541
Methods and Properties of the Control Class 543
Derived Classes of the System.Windows.Forms.Control Class 545

Copyright 2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
Table of Contents | xv

Coding Standards 581


Guidelines for Naming Controls 581
Resources 581
Quick Review 582
Exercises 583
Programming Exercises 588

PROGRAMMING BASED ON EVENTS 593


10 Delegates 594
Defining Delegates 594
Creating Delegate Instances 596
Using Delegates 596
Relationship of Delegates to Events 599
Event Handling in C# 599
Event-Handler Methods 600
ListBox Control Objects 601
Creating a Form to Hold ListBox Controls 601
ListBox Event Handlers 604
Multiple Selections with a ListBox Object 605
ComboBox Control Objects 612
Adding ComboBox Objects 613
Handling ComboBox Events 614
Registering other Events 615
Programming Event Handlers 615
MenuStrip Control Objects 617
Adding Menus 618
Adding Predefined Standard Windows Dialog Boxes 622
CheckBox and RadioButton Objects 630
CheckBox Objects 630
Adding CheckBox Objects 631
Registering CheckBox Object Events 631
Wiring One Event Handler to Multiple Objects 633
GroupBox Objects 634
RadioButton Objects 634

Copyright 2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
xvi | C# Programming: From Problem Analysis to Program Design, Fifth Edition

Adding RadioButton Objects 634


Registering RadioButton Object Events 636
Windows Presentation Foundation (WPF) 639
TabControl Objects 645
Coding Standards 686
Resources 686
Quick Review 686
Exercises 688
Programming Exercises 695

Advanced Object-Oriented Programming Features 699


11 Object-Oriented Language Features 700
Component-Based Development 701
Inheritance 702
Inheriting from the Object Class 703
Inheriting from Other .NET FCL Classes 703
Creating Base Classes for Inheritance 704
Overriding Methods 707
Creating Derived Classes 709
Making Stand-Alone Components 715
Creating a Client Application to Use the DLL 725
Abstract Classes 729
Abstract Methods 730
Sealed Classes 733
Sealed Methods 734
Partial Classes 734
Creating Partial Classes 735
Interfaces 735
Defining an Interface 736
Implementing the Interface 737
.NET Framework Interfaces 742
Polymorphism 744
Polymorphic Programming in .NET 745
Generics 746

Copyright 2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
Table of Contents | xvii

Generic Classes 746


Generic Methods 751
Dynamic 752
Dynamic data type 752
var data type 753
Coding Standards 773
Resources 774
Quick Review 774
Exercises 777
Programming Exercises 782

DEBUGGING AND HANDLING EXCEPTIONS 785


12 Errors 786
Run-Time Errors 787
Debugging in C# 788
Exceptions 796
Raising an Exception 800
Bugs, Errors, and Exceptions 801
Exception-Handling Techniques 803
Try. . .Catch. . .Finally Blocks 804
Exception Object 808
Exception Classes 810
Derived Classes of the Base Exception Class 810
ApplicationException Class 811
SystemException Class 811
Filtering Multiple Exceptions 813
Exception Filters 816
Throwing an Exception 820
Input Output (IO) Exceptions 821
Coding Standards 839
Resources 840
Quick Review 840
Exercises 841
Programming Exercises 846

Copyright 2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
xviii | C# Programming: From Problem Analysis to Program Design, Fifth Edition

WORKING WITH FILES 849


13 System.IO Namespace 850
File and Directory Classes 852
File Class 852
Directory Class 857
FileInfo and DirectoryInfo Classes 858
File Streams 860
Writing Text Files 863
Reading Text Files 869
Adding a Using Statement 873
Random Access 875
BinaryReader and BinaryWriter Classes 876
Other Stream Classes 882
FileDialog Class 883
Coding Standards 897
Resources 897
Quick Review 897
Exercises 899
Programming Exercises 904

WORKING WITH DATABASES 907


14 Database Access 908
Database Management Systems 908
ADO.NET 910
Data Providers 911
Retrieving Data from the Database 916
Processing the Data 920
Updating Database Data 928
Using Datasets to Process Database Records 929
Adding a DataGridView Control to Hold the Dataset 932
Data Source Configuration Tools 937
Add New Data Source 938
Dataset Object 946
TableAdapterManager 956

Copyright 2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
Table of Contents | xix

DataSet Designer 957


Connecting Multiple Tables 968
Language-Integrated Query (LINQ) 975
Query Expressions 976
Implicitly Typed Local Variables 979
Coding Standards 982
Resources 982
Quick Review 982
Exercises 985
Programming Exercises 990

WEB-BASED APPLICATIONS 993


15 Web-Based Applications 994
Web Programming Model 994
Static Pages 995
Dynamic Pages 998
ASP.NET 1000
Visual Studio for Web Development 1000
ASP.NET Programming Models 1001
Web Forms Page 1002
ASP.NET Web Forms Site 1003
Master Pages 1008
Cascading Style Sheet (CSS) 1012
ASP.NET Empty Web Site 1016
Controls 1019
HTML Controls 1019
HTML Server Controls 1025
Web Forms Standard Server Controls 1029
Available Web Forms Controls 1030
Web Forms Controls of the Common Form Type 1031
Adding Common Form-Type Controls 1035
Validation, Custom, and Composite Controls 1038
Validation Controls 1038
Calendar Control 1043

Copyright 2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
xx | C# Programming: From Problem Analysis to Program Design, Fifth Edition

GridView Control 1050


AccessDataSource 1060
Using Visual Tools to Connect 1060
Store Databases in App_Data Folder 1062
Setting the Visibility Property 1066
Other Controls 1068
Mobile Applications 1071
Xamarin.Forms 1073
iOS Apps 1074
Android Apps 1074
Windows Phone Apps 1075
Silverlight 1075
Universal Apps 1076
Running the App 1078
Deploying to an Emulator 1078
Coding Standards 1079
Resources 1079
Quick Review 1080
Exercises 1082
Programming Exercises 1087

APPENDIX A: VISUAL STUDIO CONFIGURATION 1089


Customizing the Development Environment 1089
Environment 1091
Projects and Solutions 1094
Text Editor 1095
Debugging 1099
HTML Designer 1100
Windows Forms Designer 1101
Other Options Settings 1102
Choose Toolbox Items 1102
Customize the Toolbars 1103
Configure and Save Windows Layouts 1104

Copyright 2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
Table of Contents | xxi

APPENDIX B: CODE EDITOR TOOLS 1107


IntelliSense 1107
Syntax Coloring 1108
Colorized Tooltips 1108
Error and Warning Marks 1109
Quick Action Light Bulb Icon 1110
Peek Definition 1112
Refactoring 1112
Extract Method 1113
Rename 1114
Other Refactoring Options 1115
Code Snippets 1115
Working with Class Diagrams 1117
Class Details View 1118
Using the Class Diagram to Add Members 1120
Other Code Editor Tips 1121

APPENDIX C: CHARACTER SETS 1123

APPENDIX D: OPERATOR PRECEDENCE 1125

APPENDIX E: C# KEYWORDS 1127

GLOSSARY 1129

INDEX 1143

Copyright 2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
Copyright 2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
P R E FA C E

© zeljkodan/Shutterstock.com

C# Programming: From Problem Analysis to Program Design requires no previous


introduction to programming but only a mathematical background of high-school
algebra. The book uses C# as the programming language for software development;
however, the basic programming concepts presented can be applied to a number
of other languages. Instead of focusing on the syntax of the C# language, this book
uses the C# language to present general programming concepts. It is the belief of
the author that once you develop a thorough understanding of one programming
language, you can effectively apply those concepts to other programming languages.

Why C#?
C# has gained tremendous popularity in the industry. C# is a true object-oriented lan-
guage that includes a rich set of instruction statements. C# was the language used for
development of much of .NET, the Microsoft programming paradigm that includes a
collection of more than 2,000 predefined classes that make up the Framework Class
Library (FCL). Thus, C# has access to a large collection of predefined classes similar
to those available to Java. C# provides tools that make it easy to create graphical user
interfaces—similar to the tools Visual Basic programmers have employed for years.
C# also provides the pure data crunching horsepower to which C/C++ programmers
have become accustomed. However, unlike other languages, C# was designed from
scratch to accommodate Internet and Windows applications. C# is an elegant and
simple object-oriented language that allows programmers to build a breadth of appli-
cations. C# is also a great language for mobile application development. It can run on
not only Windows platforms but is very portable and can run on Android and iOS
devices. For these reasons, C# was chosen as the language for this book.

Going Beyond the Traditional CS1 Course


This book was written for the Computer Science 1 (CS1) student and includes all of
the basic programming constructs normally covered in the traditional CS1 foundation
course for the Computer Science curriculum. Readers begin developing applications

Copyright 2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
xxiv | C# Programming: From Problem Analysis to Program Design, Fifth Edition

immediately in the first chapter. It includes lots of examples and figures illustrating
basic concepts. A heavy emphasis on illustrating the visual tools that can be used
to create applications is included in this edition. However, this book goes beyond
what is traditionally found in most CS1 textbooks and, because of the inclusion of a
number of advanced applications, this textbook could also be used in an intermediate
course for students who have already been exposed to some programming concepts.

Advanced Topics
After building a solid programming foundation, this book presents rapid application
development techniques that can be used to build a number of advanced types of
applications including Windows, data-driven applications using a database, and Web
and mobile applications for smart devices. Generics, delegates, ArrayLists, dynamic
data types, abstract classes, interfaces, and many advanced object-oriented concepts
are introduced. Readers retrieve data from files and store data both to sequential and
binary files. Solutions involving multidimensional arrays and other advanced collection
classes are demonstrated. Illustrating the drag-and-drop construction approach used
with Visual Studio, Windows, and Web applications are created. Readers are introduced
to the event-driven programming model, which is based on interactively capturing and
responding to user input on Windows and Web forms. Class libraries, Windows Forms
applications, and Windows Presentation Foundation client applications are created.
Two full chapters are devoted to programming based on events and then those topics
are integrated throughout the remainder of the book. Readers are introduced to ASP.
NET for Web applications and ADO.NET for working with databases.
For first-time programmers, this book is unusual in introducing applications that
retrieve and update data in databases such as those created using Microsoft Access.
A number of visual development tools are illustrated to connect to data sources.
Other interesting topics include retrieving data using Language-Integrated Query
(LINQ), developing stand-alone .dll components (class libraries), and an introduction
to Xamarin for programming applications for mobile devices. All of these advanced
features are discussed after the reader has gained a thorough understanding of the
basic components found in programming languages.

Changes in the Fifth Edition


C# Programming: From Problem Analysis to Program Design, Fifth Edition, has been
revised and updated to reflect the latest release of Visual Studio 2015 and C# 6.0. All
examples are streamlined and unnecessary using statements are removed from each
chapter. The new improvements to the code editor are highlighted from early chap-
ters and summarized in an appendix. Additional advanced object-oriented concepts
are included. Each chapter includes new programming exercises not seen in previous
editions. All example programs, exercises, and the solution set have been updated

Copyright 2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
Preface | xxv

using Visual Studio 2015. All screenshots are updated to the Visual Studio 2015 IDE.
The following summarizes some of the changes in the fifth edition.

1. New C# 6.0 language features such as auto-properties, exception


filters, and string interpolation are introduced.
2. Beginning with the first example, code is streamlined, reducing the
amount of boilerplate code needed. References to static class mem-
bers are added to all examples throughout this edition to bring static
class members directly into scope.
3. Early introduction of Visual Studio 2015 user interface improvements.
4. New debugging tools, new Windows layout features, enhanced color-
ized tooltips, simplified context menu options, and the new Quick
Action Light Bulb editing tools are illustrated.
5. All screenshots updated to reflect change made in Visual Studio 2015.
6. New Programming Exercises not found in previous editions added
to every chapter. Solutions to all exercises developed by the author.
7. Increased and updated list of Internet sites added at the end of each
chapter in the Resources section for readers to explore.
8. Additional Notes added throughout the book highlighting tips and
“catch you” types of topics.
9. Expanded Glossary provides a reference for keywords tagged
throughout the book.
10. Revised Appendices include special sections, Customizing the Visual
Studio Development Environment and Code Editor Tools, with
updated illustrations and figures.

Approach
A problem-solving methodology based on object-oriented software development is
introduced early and used throughout the book. Programming Examples are pre-
sented at the end of each chapter, and each example follows a consistent approach:
analyzing the problem specifications, designing a solution, implementing the design,
and verifying or validating the solution structures.
The author believes that the best way to learn to program is to experience program-
ming. This assumption drives the material presented in this textbook. As new con-
cepts are introduced, they are described using figures and illustrations. Examples are
shown and discussed as they relate to the concept being presented. With a hands-on
approach to learning, readers practice and solidify the concepts presented by complet-
ing the end of the chapter exercises. Readers are also encouraged throughout the book
to explore and make use of the more than 2,000 classes that make up the FCL.

Copyright 2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
xxvi | C# Programming: From Problem Analysis to Program Design, Fifth Edition

Every chapter begins with a list of objectives and a short overview of the previous chap-
ter. Text in each chapter is supplemented with figures and tables to help visual learners
grasp the concepts being presented. Each chapter is sprinkled with useful tips and hints
as NOTES on the concepts being presented. Code snippets and numbered examples
are embedded as new concepts are introduced in each chapter. In addition, each chap-
ter contains complete working programs illustrating an application using C#. Every
chapter ends with a Coding Standards section, which provides a summary of acceptable
conventions or guidelines pertaining to the chapter’s topics that focus on style issues.
A list of websites for readers to explore is included in a special Resources section at the
end of each chapter. A summary of the major points covered in that chapter and review
exercises in both objective and subjective formats are included. Every chapter ends with
programming exercises that give readers an opportunity to experience programming.

Using This Book for Two Different Courses


Although this book is primarily intended for a beginning programming course, it
will also work well in an intermediate course. For courses introducing students to
programming, Chapters 1 through 8 should be covered in detail. Depending on how
quickly students are able to grasp the material, the course could end in any of the
chapters following Chapter 8. For example, ending with Chapter 9, Introduction to
Windows Programming, would give students an opportunity to get excited about
continuing their work in programming in upcoming semesters.
For an intermediate course, where the first course was taught using a different lan-
guage, the last part of Chapter 1 along with Appendices A and B could be read to
orient the readers to running an application using Visual Studio. Students could be
encouraged to scan Chapters 2 through 7 and review Chapter 8 more extensively.
Scanning these chapters, students could compare and contrast the details of the C#
language with the programming languages they already know.
For the intermediate course where the first course was taught using C#, Chapters 4,
7, and 8 should be reviewed, because topics covered in these chapters—Creating your
Own Classes and Arrays—are often more difficult for the student to grasp. The remain-
der of the book beginning in Chapter 9 would be included for the intermediate course.

Overview of the Chapters


Chapter 1 briefly reviews the history of computers and programming languages includ-
ing the evolution of C# and .NET. This chapter explains the difference between structured
and object-oriented programming and includes the software development methodology
used throughout the remainder of the book. This chapter describes the different types
of applications that can be developed using C#. It discusses the basic elements found in
a C# program and illustrates how to compile, run, and debug an application.
The focus in Chapter 2 is data types and expressions. Readers gain an understand-
ing of how types, classes, and objects are related. They also learn how to perform
Copyright 2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
Preface | xxvii

arithmetic procedures on the data, how to display formatted data, and how expres-
sions are evaluated using operator precedence. Chapter 3 extends the manipulation
of the data through introducing methods and behaviors of the data. Readers learn to
write statements that call methods and to write their own class methods. They learn
how to pass arguments to methods that return values and to those that do not.
Readers learn to create their own classes in Chapter 4. This chapter introduces the
components of a class including the data, property, and method members. Special
methods, including constructors, are written.
Chapter 5 introduces control structures that alter the sequential flow of execution.
Selection control constructs are introduced in Chapter 5. One-way, multiway, switch,
and ternary operators used to make decisions are illustrated. Looping is introduced
in Chapter 6. The rich set of iteration operators including while, for, do while, and
foreach are explored. Recursive solutions are also explored.
Chapter 7 discusses arrays. This chapter describes how to declare and perform com-
pile-time initialization of array elements. The Array class and its many members are
introduced. Methods of the string and ArrayList classes are included in Chapter 8.
Multidimensional arrays and other collection classes, including stacks, queues, and
hash tables, are also introduced in Chapter 8.
Chapter 9 presents a different way of programming, which is based on interactively
responding to events. A number of classes in the FCL that are used to create Windows
applications are introduced. Elements of good design are discussed in Chapter 9.
Delegates are also explored in Chapter 9. Visual Studio’s drag-and-drop approach
to rapid application development is introduced and used in these chapters. The
Windows Presentation Foundation (WPF) is also introduced in Chapter 10 as an
alternative approach to Windows Forms for creating Windows applications.
Advanced object-oriented programming features are the focus of Chapter 11. Readers
are introduced to component-based development and learn how to create their own
class library files. Inheritance, interfaces, abstract classes, sealed classes, generic types,
partial classes, and polymorphic programming are discussed in detail. Advanced fea-
tures such as overriding, overloading, and the use of virtual methods are also included
in Chapter 11. Static versus dynamic typing is also investigated in Chapter 11.
Chapter 12 discusses debugging and exception handling techniques. The chapter
introduces one of the tools available in Visual Studio, the Debugger, which can be used
to observe the run-time environment, take an up-close look at the code, and locate
logic errors. The try. . .catch. . .finally block is discussed for handling exceptions. In
addition to discussing .NET exception classes, custom exceptions are designed.
Chapter 13 presents the basics of creating, opening, closing, reading, and writing
files. The major classes used to work with file and directory systems are intro-
duced. Chapter 14 introduces a number of new namespaces collectively called ADO.
NET, which consists of a managed set of library classes that enable interaction with
Copyright 2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
xxviii | C# Programming: From Problem Analysis to Program Design, Fifth Edition

databases. The chapter illustrates how ADO.NET classes are used to retrieve and
update data in databases. The visual programming tools and wizards available with
Visual Studio, which simplify accessing data, are covered in this chapter. The LINQ is
also introduced in Chapter 14.
The focus of Chapter 15 is on Web applications. Readers explore how the design
of Web-based applications differs from Windows applications. They discover the
differences between static and dynamic web pages and how HTML and Web server
controls differ. Master pages and Cascading Style Sheets are introduced. Also
included in Chapter 15 is an introduction to Xamarin used for mobile application
development. Chapter 15 illustrates how validation controls can be used to check
users’ input values and shows how the ADO.NET classes, introduced in Chapter 14,
can also be used with Web applications to access database records.
Appendix A presents suggestions for customizing the appearance and behavior of
the Integrated Development Environment (IDE). Appendix B discusses the Code
Editor features of Visual Studio. Code snippets and refactoring are described.
These new features improve programmer productivity by reducing the number of
keystrokes required to enter program statements. This appendix also illustrates
developing applications visually using class diagrams. Appendix C lists the Unicode
and ASCII (American Standard Code for Information Interchange) character sets.
Appendix D shows the precedence of the C# operators, and Appendix E lists the C#
keywords.

Features
Every chapter in this book includes the following features. These features are both con-
ducive to learning in the classroom and enable you to learn the material at your own pace.

? Multi-color interior design shows accurate C# code and related


comments.

? Learning objectives offer an outline of the concepts discussed in detail


in the chapter.

? Hundreds of visual diagrams throughout the text illustrate difficult


concepts.

? Syntax boxes show the general form for different types of statements.

? Numbered examples illustrate the key concepts with their relevant


code, and the code is often followed by a sample run. An explanation
follows that describes the functions of the most difficult lines of code.

? Notes highlight important facts about the concepts introduced in the


chapter.

Copyright 2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
Preface | xxix

? Numerous tables are included that describe and summarize information


compactly for easy viewing.

? A Coding Standards section provides a summary of acceptable


conventions or guidelines pertaining to the chapter’s topic. These
coding/programming guidelines help ensure consistency and reduce
the number of bugs and errors entered into programming projects.

? Internet sites listed including tutorials that can be used to enhance


concepts are presented in the Resources section.

? Programming Examples are complete programs featured at the end of


the chapter. The examples contain the distinct stages of preparing a
problem specification, analyzing the problem, designing the solution,
and coding the solution.

? Quick Reviews offer a summary of the concepts covered in the chapter.

? Exercises further reinforce learning and ensure that students have,


in fact, absorbed the material. Both objective and subjective types of
questions are included at the end of each chapter.

? Programming Exercises challenge students to write C# programs with a


specified outcome.

? The glossary at the end of the book lists nearly 400 key terms in alphabetical
order along with definitions for easy reference. Throughout this text, the
terms set in bold indicate that they are defined in the glossary.
From beginning to end, the concepts are introduced at a pace that is conducive to
learning. The writing style of this book is simple and straightforward, and it paral-
lels the teaching style of a classroom. The concepts introduced are described using
examples and small programs.
The chapters have two types of programs. The first type includes small programs that
are part of the numbered examples and are used to explain key concepts. This book
also features numerous case studies called Programming Examples. These Program-
ming Examples are placed at the end of the chapters to pull together many of the con-
cepts presented throughout the chapter. The programs are designed to be methodical
and workable. Each Programming Example starts with a Problem Analysis and is then
followed by the Algorithm Design. Every step of the algorithm is then coded in C#. In
addition to teaching problem-solving techniques, these detailed programs show the
user how to implement concepts in an actual C# program. Students are encouraged
to study the Programming Examples very carefully in order to learn C# effectively.
All source code and solutions have been written, compiled, and tested by quality
assurance with Visual Studio Professional 2015.

Copyright 2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
F E AT U R E S OF THE BOOK

Learning
objectives appear
at the beginning
of each chapter.

Copyright 2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
Numerous
visual diagrams
throughout the
text illustrate
difficult concepts.

Copyright 2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
Numerous tables
are included
that describe
and summarize
information
compactly for
easy viewing.

Copyright 2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
Updated screen
shots of what
readers see in
Visual Studio are
also included
throughout the
book.

Copyright 2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
Non-keyword
code appears in
a different font
throughout the
text so readers can
quickly distinguish
program statements
from normal text.

Multi-color
interior design
shows accurate
C# code and
related comments.
Throughout the
book, keywords are
shown in blue and
comments appear
in green.

Numbered examples
illustrate the key
concepts with their
relevant code,
and the code is
often followed by
a sample run. An
explanation follows
that describes the
functions of the
most difficult lines
of code.

Copyright 2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
Syntax boxes show
the general form
for different types
of statements.

Copyright 2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
Notes provide
short quick tips
highlighting
important
concepts and
features that
might be
overlooked.

Copyright 2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
Programming
Examples are
complete programs
featured at the
end of the chapter.
The examples
contain the distinct
stages of preparing
a problem
specification,
analyzing the
problem, designing
the solution,
and coding the
implementation.

Copyright 2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
Coding/programming
style guidelines and
suggestions are
featured at the end
of each chapter.

Copyright 2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
A special Resources
section at the end
of each chapter
offers a number of
web sites for the
reader to explore.

Quick Review offers


a summary of the
concepts covered in
the chapter.

Copyright 2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
Exercises further
reinforce learning
and ensure that
students have,
in fact, absorbed
the material.
Both objective
and subjective
types of activities
are included at
the end of each
chapter.

Copyright 2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
Programming
Exercises challenge
students to write
C# programs with a
specified outcome.

Copyright 2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
Special
appendices
highlight code
editor tools
and provide
suggestion for
configuring
Visual Studio
to maximum
productivity.

Copyright 2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
Preface | xliii

Instructor Resources
The following teaching tools are available for download at our Instructor Companion
Site. Simply search for this text at sso.cengage.com. An instructor login is required.
Instructor’s Manual. The Instructor’s Manual that accompanies this textbook
includes additional material to assist in class preparation, including suggestions for
lecture topics.
Test Bank: Cengage Learning Testing Powered by Cognero is a flexible, online sys-
tem that allows you to:

? author, edit, and manage test bank content from multiple Cengage
Learning solutions

? create multiple test versions in an instant

? deliver tests from your LMS, your classroom, or wherever you want
PowerPoint Presentations. Microsoft PowerPoint slides are available for each chap-
ter. These are offered as a teaching aid for classroom presentations, either to make
available to students on the network for chapter review or to be printed for classroom
distribution. Instructors can add their own slides for additional topics that they intro-
duce to the class.
Source Code for Examples. The complete Visual Studio project files for the exam-
ples included within each chapter are available for instructors and are also posted
for students on CengageBrain.com. Individual source code files are stored with a .cs
extension inside the project subdirectory.
Programming Exercises Solution Files. The complete Visual Studio project files
for the solutions to all programming exercises included at the end of the chapters are
provided. The individual source code files are stored with a .cs extension inside the
project subdirectory.

Acknowledgments
I would like to express my gratitude for the opportunity to complete the fifth edi-
tion of this book. Like the other editions, it was a huge undertaking for me. Special
thanks go out to Alyssa Pratt, Senior Content Developer, at Cengage Learning, for her
positive comments, guidance, and support. She was a pleasure to work with again on
this new edition. I am grateful to the Quality Assurance team members who verified
that each of the examples and exercise solutions worked properly. Also thanks to the
Content Manager and Copyeditor, Jennifer Feltri-George and Andrea Schein, who
provided great suggestions as we progressed with the project.

Copyright 2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
xliv | C# Programming: From Problem Analysis to Program Design, Fifth Edition

I am very grateful to the following reviewers for their uplifting comments and sugges-
tions for improvements:
Wai Mok: The University of Alabama in Huntsville
Iftikhar Sikder: Cleveland State University
Leslie Spivey: Edison Community College
I hope that the reviewers will see that many of their suggestions were implemented.
The textbook is much improved because of their contributions.

Copyright 2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
© zeljkodan/Shutterstock.com
CHAPTER
1
INTRODUCTION TO COMPUTING
AND APPLICATION DEVELOPMENT
I N THI S C H A P T E R , Y OU W IL L :

? Learn about the history of computers

? Differentiate between system and application software

? Investigate the steps of software development

? Explore different programming methodologies

? Discover why C# is being used today for software development

? Distinguish between the different types of applications that can be created with C#

? Explore an application written in C#

? Examine the basic elements of a C# program

? Compile, run, build, and debug an application

? Create an application that displays output

? Work through a programming example that illustrates the chapter’s concepts

Copyright 2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
2 | Chapter 1: Introduction to Computing and Application Development

Computers have become such an integral part of our lives today that many of their
functions are taken for granted. Yet, only a few years ago, mobile apps, text messag-
ing, and cloud computing were unknown. Social media is one of the most power-
ful sources for news updates through platforms such as Twitter and Facebook. With
today’s smartphones, many people have the computing power of mini super comput-
ers in their pockets. Video-sharing websites such as YouTube can now be accessed with
most smartphones. Advances in computing are occurring every day. Expectations
are that tablet sales will grow by 200 percent through 2016. Over 100 million units
were sold in last year. For most consumers, tablets are not replacements for their
conventional computers but are added devices they will purchase.
Much personal computing can now occur on smaller devices. Mobile applications, or
apps, for smartphones, tablets, and other wireless devices are increasingly in demand.
Today because of smartphone apps, you don’t have to worry about being lost, being
bored, or alone. To reach this level of complexity, software development has gone
through a number of eras, and today technical advances accumulate faster and faster.
What new types of computer software will be integral to our daily lives in the future?
What types of apps will be on the wearable technology such as wristwatches or
glasses for you in the future. The focus of this book is to introduce you to application
development. Before beginning the journey into software development, a historical
perspective on computing is included to help you see the potential for advancements
that awaits you.

History of Computers
Computing dates back some 5000 years. Many consider the abacus to be the first
computer. Used by merchants of the past and present for trading transactions, the
abacus is a simple calculating device that uses a system of sliding beads on a rack for
addition and subtraction.
In 1642, another calculating device, called the Pascaline, was created. The Pascaline
had eight movable dials on wheels that could calculate sums up to eight figures long.
Both the abacus and Pascaline could perform only addition and subtraction. It was
not until the 1830s that the first general-purpose computer, the Analytical Engine,
was available.
Charles Babbage and his assistant, Lady Augusta Ada Byron, Countess of Lovelace,
designed the Analytical Engine. Although it was very primitive by today’s standards, it
was the prototype for what is known today as a general-purpose computer. The Ana-
lytical Engine included input devices, memory storage, a control unit that allowed
processing instructions in any sequence, and output devices.

Copyright 2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
History of Computers | 3

In the 1980s, the U.S. Defense Department named the Ada programming language in honor 1
of Lady Lovelace. She has been called the world’s first programmer. Controversy surrounds
her title. Lady Byron was probably the fourth or fifth person to write programs. She did
programming as a student of Charles Babbage and reworked some of his calculations.
Babbage is considered the father of the computer since he conceptualized and invented
the first mechanical computer in the nineteenth century.

Many computer historians believe the present day to be in the fifth generation of
modern computing. Each era is characterized by an important advancement in com-
puter technology. In the mid-1940s, World War II, with its need for strategic types
of calculations, spurred on the first generation of general-purpose machines. These
large, first-generation computers were distinguished by the use of vacuum tubes.
They were difficult to program and limited in functionality. The operating instruc-
tions were made to order for each specific task.
The invention of the transistor in 1956 led to second-generation computers, which
were smaller, faster, more reliable, and more energy efficient than their predecessors.
The third generation, 1964–1971, saw computers become smaller, as transistors were
squeezed onto small silicon discs (single chips), which were called semiconductors.
Operating systems, as they are known today, which allowed machines to run many
different programs at once, were also first seen in third-generation systems.
As time passed, chips kept getting smaller and capable of storing more transistors,
making computers more powerful and less expensive. The Intel 4004 chip, developed
in 1971, placed the most important components of a computer (central processing
unit, memory, and input and output controls) on a minuscule chip about half the size
of a dime. Many household items such as microwave ovens, television sets, and auto-
mobiles benefited from the fourth generation of computing.
During the fourth generation, computer manufacturers tried to bring computing to
general consumers. In 1981, IBM introduced its personal computer (PC). The 1980s
saw an expansion in computer use as clones of the IBM PC made the PC even more
affordable. We also saw the development of graphical user interfaces (GUIs) and the
mouse as a handheld input device. The number of PCs in use more than doubled from
two million in 1981 to 5.5 million in 1982. Ten years later, 65 million PCs were in use.

According to the 2013 U.S. Census Bureau’s Current Population Survey, over 83.8% of
households in the United States had computers at home. Over 73% reported having a
high-speed Internet connection at home.

Copyright 2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
4 | Chapter 1: Introduction to Computing and Application Development

Widespread use of computer networks and parallel processing, where computers


use more than one CPU for faster processing speeds, characterize the current fifth-
generation systems. Fifth-generation devices are still in development. Smaller devices
with touchscreen capabilities using mobile apps are growing.
The real power of the computer does not lie in the hardware, which comprises the
physical components that make up the system. The functionality lies in the software
available to make use of the hardware. Computers can now accept spoken word
instructions, imitate human reasoning through artificial intelligence, and commu-
nicate with devices instantaneously around the globe by transmitting digital media.
By applying problem-solving steps, expert systems assist physicians in making diag-
noses. Healthcare professionals are now using handheld devices in patients’ rooms
to retrieve and update patient records. Using handheld devices, drivers of delivery
trucks are accessing global positioning systems (GPSs) to verify locations of custom-
ers for pickups and deliveries. Sitting at a traffic light or in a restaurant, you can check
your text messages, make airline reservations, remotely monitor and manage house-
hold appliances, and access your checking and savings accounts. Using wireless net-
works, students can access a professor’s notes when they enter the classroom. These
things are all possible because of the software, the applications controlling the hard-
ware devices. Because of the programmability of the computer, the imagination of
software developers is set free to conjure the computing functions of the future. Soft-
ware developers are able to help make ideas come to reality faster. The next section
begins the discussion on software, which is the focus of this book.

According to the Bureau of Labor Statistics, employment of software developers is


projected to grow 22 percent from 2012 to 2022, much faster than the average of all
occupations. The Occupational Outlook Handbook also reported the median pay in 2012
for software developers with a bachelor’s degree and no work experience was $93,350
per year.

System and Application Software


Software consists of programs, which are sets of instructions telling the computer
exactly what to do. The instructions might tell the computer to add up a set of
numbers, make a decision based on the result of a calculation, or translate a sentence
from one language into another. Just as a cook follows a set of instructions (a recipe)
to prepare a dish, the computer follows instructions without adding extra salt to
perform a useful task. Instructions for computers have also gone through a number
of stages or generations.
Machine code instructions, or programs, that were executed directly by the CPU
were used with general-purpose machines in the 1940s. Back then instructions were

Copyright 2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
Another random document with
no related content on Scribd:
— Tanssitaan, reputetaan… antaa heinien kuivaa.

Tanssiraivo tarttuu toisiin, ja ladon edustalla hypitään, reutoillaan,


viinapiimän hulluuttamina. Jooseppi suu selällään rallattaa ja lyö
kepillä tahtia maitohinkin kylkeen.

Ukkonen on jyrähdellyt, mutta kukapa sitä jouti kuulemaan.

Tulee sade, vettä ropisee kuin kaatamalla.

Heinäväki latoon, suinpäin heinien sekaan, henkihieverissä


huohotellen.

Kastui kolmen talon heinät, minkäpä sille… Kuivaavathan ne


haasioilla.

*****

Hörödiin on pitänyt lähteä tuomaan rämekorpelaisille


uhkavaatimusta käräjiin, jotka nyt on määrätty yksinomaan
rämekorpelaisia varten.

Katselee todistajineen salaa pensaan takaa niittyväen tanssia.

Haistettuaan pulloja ja piimäastioita ilmestyy Hörödii ladon ovelle,


kun ollaan siinä asettumassa lepäämään ja sadetta pitämään.

Kun huomaa Joosepin, sanoo kiireesti sanottavansa ja lisää siihen


omistaan iskevää höystettä:

— Tasavallan ja resitentin nimessä käsken viikon perästä


pidettäviin käräjiin, ryyppäämisestä, maistamisesta ja
keitättämisestä. Raudoissa haetaan, jos ei muuten tulla.
— No, ala sitten painella, sanoo Jooseppi niskaharjakset pystyssä
ja heittää piimätuopilla poliisia.

— Kyllä, mutta sakon saat piimätuopilla heittämisestäkin, uhkaa


Hörödii ja menee menojaan.

Istutaan ja mietitään, sen kuin päätä viipottavalta humalalta


jaksetaan.

— Taitaa olla nyt kova paikka, helvetin tuli ja leimaus, arvelee


Käkkä-Antti.

— Taisipa, tuota… kun resitentin jo veti, heh, tämä Hörökki.

— Ja tasavallan… se tuota… tiukka pykälä… on tästä lupsuteltava


sinne syötinkilöihin, irvistelee Asari. — No, kun tästä heinät… ei
kiirettä, hätää mitään. Maksetaan… rahalla… hii..

Painosti se asia, vai ilmako lienee. Kohta kuitenkin alkoi kuulua


mahtava kuorsahtelu ladosta.

*****

Päivän laskettua palattiin niityltä.

— Heinien kanssa siellä häärättiin näin myöhäiseen, lekersi Asari


Tiina
Lovisalle tosissaan.

— Heh, olithan tuota nyt kerran sinäkin työssä, sanoi Tiina Lovisa
hyvillään.
KYMMENES LUKU.

Bertil on ohikulkiessaan nähnyt sen rähjäämisen ladon edessä.


Katsonut, mutta ei mennyt joukkoon.

Se yhtämittainen turaaminen on käynyt hänelle jo


vastenmieliseksi. Vaikka siitä löytää aiheita, on siinä väliin kuin
näkymättömän käden tuomio korven huumorin häviöstä hulluuteen.

Bertil istuu rantakivellä auringonlaskua katsellen ja koettaa tutkia


syytä vastenmielisyyteensä, jota poskipäissä näkyvä ainainen viinan
punerrus synnytti.

Hiertiäinen, korven ilmetty piru, ja Käkkä-Antti, ne nyt, mutta


kaikki muut. Ne kaksi, Aatami kolmantena, olisivat menneet mukiin,
mutta Joosepinkin, jättiläisen, silmissä kiilsi jo hulluus.

Hän on pari päivää sitten tehnyt muutamien päivien pyörämatkan


pitäjälle, etsiäkseen uutta ja nähdäkseen, ovatko ihmiset siellä
niinkuin täällä Rämekorvessa kuin hyviä jumalia.

Käynyt taloissa ja torpissa ja palannut pettyneenä. Harvapuheisia,


ilottomia, vain muutamilla pila silmäkulmassa.
Korvessa melkein yhtämittaa tippuva viinako antoi näille,
rämekorpelaisille, iloisuuden, loppumattoman hyvyyden, mutta
samalla jälkiseurauksen: hulluuden?

Rämekorpi? Mikä se oli ihmisineen? Arvoitus, jota hän ei pystynyt


selvittämään.

Eikä tahtonutkaan.

On aikansa ja nauttii, menee ja tulee takaisin silloin kun tahtoo,


jos haluttaa. Täältä löytää ainakin yhden, Kyllin, korven kukan,
huumaavan yöhuilun, jota ei voi pian unohtaa, tuskin milloinkaan.

Hänkö rakastunut? Tuskin. Nykyaikaiseen naiseen ei kannattanut,


eikä voinutkaan, hän ainakaan, rakastua. Siten kuin hän sen sanan
käsitti.

Kylliin kuitenkin kaikista eniten.

Tyttö ei koskaan kysellyt hänen entisyyttään, ei edes


vanhempiaan, eikä viitannutkaan mihinkään vastaisiin. »Menet ja
unohdat pian», sanoi, ja siinä oli surua, mutta ei valitusta.

*****

Aurinko laskee. Vesillä ja mailla palaa illan punerrus. Tyyntyy.


Ruohikko vain vähän vielä nuokkuu.

Siinä rantakivellä, äsken menneitten päivien tuntemuksia ja


kuvasarjoja muistaen, voisi istua määräämättömät ajat, unohtaen,
missä on syntynyt, kasvanut ja elänyt.
Hänen suonissaan on nyt korven voimaa, olemuksensa Kyllin
nuoren veren huumaa tulvillaan. Ja kuitenkin täytyy hänen jättää
tyttö ja tämä korpi, ehkä jo piankin.

Vain sellaisten naurettavan vähäpätöisten seikkojen vuoksi, että


sai polkea väsyneenä suurkaupungin katukäytäviä, istua jaarittele
vien toverien kanssa kapakoissa ja nähdä inhoittavia
kinttutaiteilijoita, kuulla muka mieltäylentävää musiikkia ja huomata
päiviensä kuluvan hukkaan.

Mökki, työpaja tuolla lahden rannalla, maan ja metsän tuoksut


ympärillä.

Niin oli sitä aurinkoisina päivinä ja hämyisinä iltoina suunniteltu.


Kylli siihen ei luottanut, eikä hänkään.

Hän pelkäsi eroa, mutta ei voinut sitä välttää. Kirottu, raajarikko


ihminen!

*****

Kylä asettuu lepoon. Pihoista kuuluu ääniä, joku soutaa järvellä.


Saunotaan, turistaan, mennään makuulle. Onnellisia ihmisiä, jotka
eivät tiedä mistään muusta.

Pilviä ja illan punaa kuvasteleva vesi kohahtaa. Kylli ui siellä


mitään tietämättä hänestä, Bertilistä.

Huomaa ja huudahtaa:

— Sielläkö sinä, ja minä kun etsin sinua! Menetkö saunaan,


odottavat?
— En.

— Tule sitten tänne. Vesi on lämmintä, uidaan unholaan.

— Minä tulen!

Rinnan uivat Bertil ja Kylli taivaan sineä ja pilvien kultaa


kuvastelevalla pinnalla.

— Uidaanko yli selän?

— Miten vain.

— Pois jokapäiväisyyksien maailmasta.

— Yhtämittainen sunnuntaihan meillä on ollutkin, sanoo Bertil,


heittäytyen lepäämään. — Pian taitaa kuitenkin tulla arki…

— Miten niin? Tai kyllä minä sen jo arvaankin. Sinä lähdet?

— Tiedäthän että täytyy.

— Niin, niin. Olisit kuitenkin jättänyt sen sanomatta tänä iltana.

Iloinen Kylli muuttuu surulliseksi, pysyy tuskin veden pinnalla.

Käännytään rannalle. Bertil aloittaa vesisodan, ja kisaten mennään


maihin. Luonto auttaa heitä, ihmislapsia, unohtamaan.

*****

Ukkoja istuu saunan jälkeen aittojen portailla, hurstisissaan,


huolettomina jaaritellen, kaskuja, joille yhdessä nauretaan.
Hiertiäinen on taas tullut Kenkkulaan saunomaan ja
valehtelemaan.

Puhuu linnustamisestaan:

— … se lintuasia vetää, näätsen, ja kun on oikea metsämies, niin


ei tarvitse pyssyä. Minäkin kerran reuhasin tetrilöitä makuuksesta…
poikamiehenä kun oltiin… ei muuta kun seipäällä peppuun tökkilöin.
Lentävät ja kotkottavat, no, eihän siinä muuta kuin konttiin.

— Tais olla tetrilöitä.

— Piikoja ne olivat, mutt’ei Asari muista.

Hohotetaan Hiertiäisen linnuille, vaikka yö jo alkaa olla puolessa.


YHDESTOISTA LUKU.

Koko Rämekylän väki on oikeudessa.

Hörödii on hyvillään, että on saanut heidät tulemaan,


Hiertiäisenkin, ja Käkkä-Antin, jotka hänen mielestään ovat niitä
pahimpia.

Aatami istuu pöydän päässä niinkuin iso isäntä ainakin. Pohahtaa


väliin ja polttelee sikariaan, naamassa viinan punerrus, niistäpä
eväsviinoista, joita on kirkonkylään tullessa maisteltu.

Käkkä-Antti ja Hiertiäinen istuvat vierekkäin penkillä, ja


Hiertiäisellä on kourassaan iso piippunsa, jota sytyttelee ja rassailee.

Ja löyhkää niin vietävästi. Ihan pitää jo Antin siitä huomauttaa:

— Minkä tähden sinä… niin… hitosti… pölyät?

Asari hymähtää. Hiisiäkö se Anttia liikuttaa … tässä omaksi


ilokseen, tuhnailee… Höröläisen nokkaan, joka siinä permannolla
paseerailee ja räpistelee kuin kukko tunkiolla.

Antin kolmikulmaiset silmäkolot ovat kovin punaiset, ja sääriäkin


kolottaa.
Taitaa se pelko — Antin silmäräpylät lupsahtelevat avuttomasti —
noihin sääriin…

Asari ei sano pelkäävänsä tyhjiä, mutta kyllä häntä peloittaa, ne


syötingit, vallesmannit ja — kirkkokin. Oli kovin uhkaavan näköinen,
kun tultiin.

Vaikka mitäpähän tuosta… eivät kai ne linnaan vie maistamisesta.


Ja kun ei sano maistaneensa, muuta kuin voidelleensa reumattia.

Sanottava kai se on, että Turakalta on saanut. No, minkä sille…

Turakka on taas missä lienee. Eivät saaneet taaskaan käsiinsä.


Eivät
Patrakkata sen paremmin.

Hiertiäinen ei piittaa niin mitään koko käräjistä, ei sano


piittaavansa, vaikka vähän tuntuu oudolta… nämä vieraat paikat,
kirkot ja tapulit. Ei ole niissä käynyt kun nuorna miesnä, pappiloissa
ja muissa Herran huoneissa. Ei hautuumaallakaan. Se hänen
luontonsa kun aina vain sinne korpiin.

Kun siellä on kuitenkin parasta… lekettää, talvella pirtin sängyssä,


kesällä saunan lavoilla, luodolla ja muissa mukavissa, kotoisissa. Nyt
nämä lakinsa, ettei saa olla rauhassa, piru, vaikka omistaan elää ja
tinkimättä veronsa maksaa.

— Käy jo vähän nurkan takana tuulettamassa, sanoo Antti Asarille.


Kun siinä… iii… että ihan nenä halkeaa, hänenkin… vaikka ei
vähistä…

— Piruako se siinä… kyllähän tähän… mahtuu.


Sivupenkillä istuu renkilöitä ja muita, akkaväkeä, Syllykkä ja
Hameniemen piiat, kirkkotamineissaan, nauraa virskutellen
Hiertiäiselle, joka siinä iskee silmää heille, piioilleen.

Odotetaan tuomaria, sitä syötinkiä, joka näitä käräjöitä,


oikeuksiloita kuuluu istuvan.

Rengit pitkästyvät jo siihen vuottamiseen ja käyvät nurkan


takana… maistamassa, salaa, ettei Hörödii näe. Palataan
röyhtäytellen tupaan, neilikkapurua jauhaen, ettei henki haise
väkeville.

Pistetään piippuun ja Hörödiin kiusaksi sysätään joku


suuruspommi, hihitetään.

Sillä mitäpä väliä heille, renkilöille, vaikka linnassakin, niistä


pommiloista ja muusta, ryyppäämisistä.

Jooseppi istuu ikkunanpielessä, ukko- ja akkaväen vaiheella,


kuparinvärinen naama hiessä ja silmät muljahdellen.

Hänetkin tänne, vaikka töitä olisi pitänyt puskea. Häntäkin


neuvottu, miten sanoa, mutta hänpä sanoo niinkuin on, että
omastaan on ryypännyt eikä toisen omaan koskenut, ja jos on rikos
omaansa ottaa, niin viekää vaikka helvettiin, mutta laittakaa
Kenkkulaan neljä miestä hänen tilalleen töihin ja varatkaa semmoiset
raudat kynkkiin, että kestävät.

… kele! Tässä pitää istua ja noljottaa, herrojen silmätikkuna.

Jopa tulee vallesmannikin ja hymähtää nähdessään Rämekorven


järeät ukot penkkilöillä. Käy siitä kamariin Hörödiin kanssa, ja Nuutti,
joka istuu kuin vaivainen peltovaris kamarin oven pielessä, kuulee
keskustelun.

— Tiedä pitää kitasi kiinni siitä keväällisestä Rämekorvessa


käynnistä, sanoo nimismies Hörödiille.

— Mutta jos asia vaatii… eihän siitä nimismiehelle sakkoja…

— Vai ei, sinä hölmö, kun akka, Pyllykkä, todistaa, että olen
ostanut. Jos vaan nokkasi avaat, niin minä varmasti nujerran niskasi.
Jätän koko viran — elän minä muutenkin — ja sitten katkasen vaikka
kaulasi.

— Helvetti… on siinä…

— Mikä? Pidä nyt jo turpasi, tahi kun minä loksautan tuolla


nyrkillä… et jumaliste minua paina. Täytyyhän tässä ajaa sitä asiaa,
mutta menköön miten tahansa, se on sama.

— Niinhän se… silläpä ne taisivat viinakuninkaatkin päästä


livistämään ja aina pääsevät.

— Haista sinä… ja herkeä loksuttamasta suutasi, tahi sylkäsen


sinne.

Keskustelu loppuu, kun tuomari tulee, ja istunto aloitetaan.

— Kaikki asialliset sisään, huutaa Hörödii tuvan ovelta, ja ukot


lähtevät valumaan käräjäsaliin.

Mällit poskessa seistään ja kuunnellaan nimismiehen


kannevaatimusta.
Keitättäneet viinoja… heh… kuka sen on nähnyt… luuli tässä
pahemmastakin, miettii Asari.

Aatami seisoo rinta pystyssä, niinkuin syytön ainakin, silmäillen


musertavasti tuomaria ja lautakuntaa.

Todistajat käsketään ulos ja asiallisten kuulustelu alkaa. Asari ja


Käkkä-Antti saavat jäädä ensiksi tiliä tekemään maistamisistaan.

Tuomari:

— Kumpi teistä on Asari Hiertiäinen?

— Tämähän se…, viittaa Käkkä-Antti.

— No Hiertiäinen on sitten keitättänyt viljoistaan viinaa ja


tarjonnut sitä muillekin, aloittaa tuomari.

— Eikös… valepuheita…, virkkaa Asari ja sylkeä tirskauttaa. — Ja


jos sitä sattuisi saamaankin, viinoja, ryypättäviä, niin voiteena toki
sitä… vai tarjoamaan. Eipä ne herratkaan nykyisin… latkivat omaan
suuhunsa… tuota… en minä nyt tässä syötinkiä…

— Jo toki voiteena, niinkuin minäkin, sanoo Antti ja kekkerehtii


paininpuillaan.

— Mutta siellä on kuitenkin keitetty viinaa, Turakka ja se toinen,


sanoo nimismies.

— Jos lienevät, mikä heidän puuhiaan… sitä kun on


Hameniemessäkin työtä… heijän puuhiaan syynäämään ja henkiä
haistamaan, kun se tämä Hörödii sitä varten…
— Haisteleeko Benjaami Hörödii henkeä? kysyy tuomari, ja
poskilihaksia vähän nykii.

— Jo toki se haistelee, vaikka mitä, todistaa Asari. — Ja penkoo ja


puurtaa, vaikka eihän siellä mitään Rämekorvessa, taloissa
ainakaan…

— Mutta kun tämä Hörödii on semmoinen nuuskija,


häntäkärpänen, eikä anna rauhaa, teristyy Antti, mutta
keskeytetään.

Hörödii siitä kertomaan mitä on nähnyt. Sanoo viimeksi


rämekorpelaisten juoneen viinojaan piimänkin kanssa, kun ei kai
enää muuten kurkkusesta valunut.

— Vai piimän, naurahtaa Hiertiäinen. — Kun oli talvellista piimää ja


haisi väkevältä, niin tämä luulee, että viinoja…

Hörödii sanoo olevan todistajat.

— No mitä tämä Antti Tanula tietää? On kai keitättänyt niinkuin


muutkin isännät viinoja?

— Vai minä… köyhä mies… ei riitä penikoillekaan leipä.


Peukalonpiäkön verran sai tässä… siitä on nyt jo toista vuotta…
taitaa… kinttujen voiteeksi, kun ovat tämmöiset.

Ja Antti näyttää paininpuitaan.

— Kun reumatti, piru, väänteli ja koukisteli.

Hörödii todistaa Antinkin olleen niityllä hutikassa ja muulloinkin.

— Ei pitäisi puhua konstaapelin… kun ei tiijjä… vissisti…


— No Antti samoin kuin Asarikin ovat nähneet Turakan ja Patrakan
korvessa viinaa keittävän?

— … häntä niin muista… taisi tuo tässä keväällä, mutta ottakaa


kiinni, ilkkuu Hiertiäinen. — Minkäpä me niille, jos missä keittävät…
hii… kun tässä pitäisi poliisiksi.

— Niin, ihan vahtimaan jos kuka missä keittäisi, vahvistaa Anttikin.

Ukot seisovat hikisinä, mälliä suussaan ahkerasti kääntäen. Asari


jo tarttuu piippuunsa ja massiinsa, mutta muistaa missä ollaan ja
työntää ne housujensa taskuun.

Tuomari tuhistaa nenäänsä ja avaa ikkunan. Lautakunta


naurahtaa. Ilma olikin käynyt jo kovin vahvaksi.

Tulee toisten vuoro, ja Aatami pohahtelee kuin tuuliaispää.

Syytetään Aatamia siitä, mistä toisiakin. Aatami sanoo saaneensa


toisilta repijäisen voiteeksi.

Kun näissä jaloissa on semmoinen tauti, rimputtaja… leini vai


reumattiko lienee… sitä voidellut… muuta ei… tämä Hörödii on
pakana… tulee hänen kamariinsa ja istuu lakki päässä, kun hän
veisaa… uskostaan ja Herran armo töistä… häntä näin kuljetellaan ja
ahdistellaan.

— Mutta… Herra varjelee minua ja antaa ne häpiään tulla, jotka


tahtovat minun niellä, sanoo Aatami ja sulkee sitten visusti suunsa.

Ei muuta kuin tohahtelee raskaasti, näittenpä vainoojiansa


jumalattomuutta, eikä enää vastaa tuomarin tekemiin kysymyksiin.
Käsketään ulos.

Jooseppi tulee sisään vanhimman veljensä kanssa hirveästi


mulkoillen. Joosepin pää hipoo käräjäsalin kattoa,- ja tuomari sanoo
melkein nöyrästi:

— Nuutti ja Jooseppi Kenkkula?

— Niin.

— Mitä tietää Jooseppi, onko viinoja keitetty, ostettu ja…

— On keitetty ja juotu, että nyrkit kankaassa. Muihen asioihin en


tiedä, mutta omastani puhun, että olen keitättänyt välistä omistani ja
väliin ostanut, mutta omilla hankkeillani, ja maksan rikkeen rahalla
tai istun linnassa, jos miehiä laitetaan yhden miehen töitä
vastaamaan.

— No teissä on miehuutta, kun tunnustatte, sanoo tuomari. —


Mitä Nuutti sanoo?

Nuutti räpistelee kuin uitettu koira, niistää nenänsä ja vilkuilee


pelokkaasti ympärilleen.

— Onhan sitä, Herra paratkoon, tullut rähjätyksi, kun se syntinen


liha vetää ja viekottelee. En kiellä, vaan kadun katkerasti, kun on
tullut tässä vielä esivaltaa vastaan rikotuksi.

Nuutilta kysytään, kuka on keittänyt, mutta Jooseppi karjasee:

— Et puhu siitä mitään, kun tässä kerran ei kenelläkään syytettä


keittämisestä, muuta kuin juomisesta.

— Siellä Rämekorvessa on siis joka mies nauttinut?


— Kysykää itseltään, joka on ryypännyt, kivahtaa Jooseppi.

No minkä sille… näiltä juupeleilta ota selvää.

Kuulustellaan vielä kerran todistajia ja Hiertiäistäkin.

— Mistä te olette kotoisin? kysyy tuomari Asarilta.

— Heh… eikö tuota tuomari tienne… mistä tämmöinen oikea


Hiertiäinen… ne olinpaikat tiietään…

Jauhetaan juttua iltamyöhäiseen ja sakotetaan vain Nuuttia ja


Jooseppia.

Nämä toiset hyväkkäät osaavat nahkansa suojella. Aatamillakin


Uusi testamentti taskussa ja Hiertiäisellä se viisautensa.

Lähdetään ajelemaan kotinurkille, viisastellen ja maistellen,


harjakaisia, kun siitä niin selvittiin.

Hämyiseen heinäkuun yöhön haihtuu maantiellä ajavien


rämekorpelaisten loilotus.

Kotiin päästyä jysketään aamun koittoon, auringon nousuun.


Saunotaan ja syödään.

Ryypätäänkin, käräjäin kunniaksi.

Haetaan Perttelikin mukaan ilonpitoon, hohotetaan ja nautitaan


olosta, ja heinäkuun yöstä.

Kun ei tämän ihmeempää, tässä jutussa. Päivä vain meni niihen


herrojen, syötinkilöihen kanssa.
Mutta onpa päiviä, kun heinäkuu on vasta puolitiessä menossa.
KAHDESTOISTA LUKU.

Bertilin, helsinkiläisherran, läksiäisiä vietetään.

Perttelin lähtö on tullut yhtäkkiä ja odottamatta rämekorpelaisille.

Kun ihan jo ystäviä näätsen, tälle maalarille, rikkaalle herralle, joka


sanoi niin heistä tykkäävänsä, rämekyläläisistä.

Hiertiäistä se varsinkin surettaa.

Kun jo niin monet kerrat turistiin… kaikista asioista… kalat


keitettiin ja tytöt halattiin… hänkin, vaikka tällainen länttähousu,
puruturpa… narrattiin ahvenia ja paistatettiin päivää rantakivikolla.

— Kyllä Perttelin pitäisi jäädä vielä elotalkoisiin, sanoo. — Silloin


sitä jysketään, piru, kun uutisen mehu kiertää suonissa,…
uutisviinatkin maistettu, ja tanssitettu tyttöjä, lupsuteltu.

— Täytyy nyt tällä kertaa jättää.

Bertil järjestelee maalauksiaan, joita on karttunut kesän kuluessa.

— Näitä kuvasia vissiin sinne kaupuntloihin … heh… herroille. No,


tulet sitten kun saat nämä kaupatuksi, näytellyksi.
Bertil kuuntelee sitä lökertämistä ja hymyilee surullisesti. Miks'ei,
piru vie, hän voi jättää kaikkea, tauluja ja kuvasia, ja jäädä iäksi
korpeen! Miks'ei hän voisi jäädä tänne mökkiläiseksi, maamieheksi,
opetella kylvämään ja kyntämään, niinkuin Aatami on jo hänelle
esitellyt.

Ottaisi Kyllin vaimokseen ja jättäisi humisevat kaupungit.

Tuvassa tanssitaan ja jysketään. Ikkuna on auki, ja


surunvoittoinen sävel tulvehtii sieltä pihamaalle, hedelmällisyyttään
raskaana nuokkuvan ruispellon yli rantaan, jossa hän odottaa Kylliä,
sanoakseen tytölle jäähyväiset.

Kylli tulee hiljaisena ja alistuvana, kyynel silmäkulmassa.

Laskeutuu Bertilin jalkojen juureen ja painaa kultakiharaisen


päänsä hänen syliinsä.

Ei kuulu valitusta tytön huulilta. Koettaa tukahduttaa


huokauksensakin, ettei toinen niitä kuulisi.

Bertil lupaa kirjoittaa, tulla katsomaan, lähettää kuvansa, jos Kylli


haluaa.

Lupaa, ja samalla häpeää, että tällaisilla koettaa hyvittää ja


lohduttaa tyttöä, joka on kaikkensa hänelle antanut eikä mitään
pyydä.

Illan punerrus mailla ja vesillä on sammunut. On vain hämyinen


yö.
Värit ovat sulautuneet toisiinsa, ne tuntee, mutta ei erota.
Kuivuvan heinän ja kypsyvän rukiin tuoksua. Ruisrääkkä vain
ääntää pellon laidassa.

Kaikki tämä ja Kylli tuossa, ja pihasta kuuluva hanurin mollisävel


viiltää haikeasti…

Monet kylätanssit käyty Kyllin kanssa, tällaisina öinä, metsäpolkuja


taivaltaen, onnellisena, kaikki unohtaen.

Valoisina iltoina ja öinä Kylli vain hänen polveensa nojaten


istumassa tyvenien vesien partaalla, vakavana ja hiljaisena,
paljastaen kauniita ajatuksiaan hänelle.

— Jospa minä vielä tulenkin tänne kokonaan. Laitetaan pieni


mökki tuonne lehtoon järven rannalle.

— Voi, älä puhu siitä… et sinä tule… se suuri maailma vetää


sinua… tuskinpa näen enää milloinkaan.

Niin, se vetää häntä, se siellä ja tämä täällä. Jos hän väsyy siellä
ja kyllästyy niinkuin jo kerran ennen, palaa varmasti tänne,
terveeseen maaperään, Kyllin luokse, joka häntä varmasti odottaa,
vaikk'ei sitä sano.

Ei, totisesti hän ei voi nyt lähteä, jollei koeta vapautua tytön ja
tämän yön lumoista.

— Tyttö, lähtään vielä kerran tanssimaan, pyytää Bertil.

— Mennään. Siellä on minunkin helpompi ollakseni.

Syntyy riemu, kun he menevät pirttiin. Bertil kuulee heidän


ohimennessään portailla kuiskuteltavan:
— Komea pari.

— Ovat varmaankin salakihloissa.

Kyllikin kuulee sen ja punastuu.

He aloittavat, ja toiset parit väistyvät syrjään. Tyttö painautuu


häneen, ja he lentävät melkein, kaiken katkeran unohtaen, eronkin.

Kun he lopettavat, juoksee Kylli ulos, jonnekin aittaansa tahi


kamariin, kun ei jaksa olla siinä… jokaisen katseltavana.

Bertil jää.

Ukot alkavat lökertää. Anttikin toikkaroi hutikassa ja sanoo tulevan


julman ikävän… tätä Pertteliä… kun herroista ihan mukavin… vaikkei
enää maistakaan, mutta muuten olossaan eläväinen ja… piru vie,
häntä ihan itkettää.

— Mitä sinä Käkkä… annahan kun minä…

Hiertiäinen työntää Antin syrjään.

— Se on niin, että ensi kesänä, jos eletään… niin reistataan, piru,


luodolla ja muualla… haukia ja kuhia semmoisia kuin sikoja…
paistetaan.

Tänne jouluksi… jos passaisi. Laitettaisiin oikeat oluet, jos ei enää


näistä viinoista… kynttilät ja kuuset, perr-setti!

— Niin, jouluksi! Tulkaa jouluja tänne viettämään, pyytää jokainen.

Bertil saa riemastuttavan ajatuksen. Hänpä tuleekin talvella tänne


korpeen. Jouluksi todellakin, syömään maalaisten jouluruokia,
maalaamaan.

— Ne joulusaunat… ja muut… maalataan … kähnitään…

— Minä tulen, lupaa Bertil.

— Ihanko varmasti?

— No ihan varmasti… tuohon käteen.

Paiskataan kättä ja remutaan.

Bertil lähtee etsimään Kylliä, sanoakseen hänelle päätöksestään.

Kylli on mennyt aittaansa ja pielukseen nojaten siellä nyyhkyttää.

— Pyytävät tulemaan tänne jouluksi. Lupaan tulla, jos sinäkin


pyydät.

Tyttö kavahtaa hänen kaulaansa, suutelee, loppumattomiin.

Bertilin yhtäkkiä leimahtanut ilo sammuu, omaansa ja tytön


haikeaan ikävään.

Niin, nehän olivat vain lupauksia, mutta tämä, nykyhetki oli


todellisuutta. Tuolla nurkissa oli vielä juhannusyön kukkia,
keskikesän henkeä, pitkä, kiihkeä satu ja kuitenkin lyhyt kuin kesäyö.

Ulkona jo vaikenee. Tuvan räystäällä visertelee pääsky.

Bertil avaa aitan oven. Molemmin jäävät siihen vielä hetkiseksi,


aamun sarastukseen.
— Kuule, Bertil, yhden asian minä lupaan sinulle, vaikka et
tahdokaan.
Tämän jälkeen ei… saa enää kukaan toinen koskea minuun.

Bertil on kuullut jo ennenkin tällaisia vakuutuksia, mutta ei ole


uskonut. Tätä hän ei saata epäillä, siksi hän jo tuntee tytön.

— Kylli, sinun on tultava iloiseksi jälleen. Tule saattamaan minua.


Onhan meillä vapaus, minullakin, tulla tänne milloin haluan, ja tulen
ehkä piankin.

Bertilin tavarat ovat jo rattailla, ja Salomo odottaa pihaportilla.


Läksiäisväki hajoaa kyläteille, ja Perttelille toivotellaan onnea
matkalle ja kärtetään pian tulemaan.

Aatami seisoo hajasäärin tuvan kuistilla ja räpyttelee silmiään.


Ovat kosteat, mistä lienevät. Bertilin kapea käsi ihan hukkuu hänen
isoon kouraansa.

— Tule vain pian tänne… pidän kuin omaa poikaa, parempanakin.


Ostetaan talo, jäät asumaan. On rahaa ja tavaraa, olla miten vain.

— Tottahan tuota edes kirjeen laittanet, sanoo emäntäkin.

Kylli on ottanut ylleen raitaisen pukunsa, joka hänellä oli


juhannusyönä ensikerran. Sanoo lähtevänsä laivarantaan, ehkä
siitäkin edelleen.

— Vie tytön matkassaan, hii… tämä Perttuli, nauraa Hiertiäinen.

— Eipä tiedä, jos jäänkin tälle tielleni, naurahtaa Kylli jo


vapautuneena.
— Eikö hiisilöissä, toimittaa Käkkä-Antti, joka uskollisena vieraalle
on jäänyt lähtöä katsomaan. — Pitäähän toki… vaikka kihlajaiset
täällä… ja muut kemut… Kyllä vuotellaan.

Bertil nostaa tyttönsä rattaille, istuu viereen ja viittoo vielä kerran


niille heikkouksistaan huolimatta hyville ihmisille, joiden veroisia ei
ole ennen löytänyt.

Huiskutetaan ja viitotaan. Hiertiäinen huitoo naulan painavalla


piipullaan ja kohottelee housujaan.

Kyllin nauru kuuluu iloisena rattailta.


KOLMASTOISTA LUKU.

Hameniemen saunasta tuprahtelee sankka savu kuulakasta elokuun


iltataivasta vasten. Turakka heittää sylyksen vielä halkoja uuniin ja
puuskuttaen tutkii kiukaan kuumuutta. Tänään on rämekorpelaisilla
uutisen juhla, ja ukot aikovat sitä viettää Hiertiäisen saunassa,
erillään muista, viinoineen ja viisauksineen.

Hiertiäinen istuu alassuin käännetyllä pytyllä ja syljeksii Tanulan


Antin paljaille varpaille. Aatami on sijoittanut ruhonsa vanhaan
korvoon tukkimilleen heinille ja nousuhumalassa laulahtelee: »…
tuolla puolen Jordanin». Patrakka, mustaparta, vilauttelee silmää
Asarille, vatsallaan loikoen tuoksuvassa saunakukkarykelmässä,
käden ulottuvilla puteli, josta maistaa ja tarjoaa toisille.

Turistaan kaikesta joutavasta. Hiertiäinen katselee metsän takaa


nousevaa kuuta ja viisastelee:

— On se tuokin… toisen kerran kutistuu ja sitten taas kasvaa…


ihan kuin… heh, heh, mikä lie pahulaisen pallo… kiekuttaja siellä
taivaalla … kun se Pertteli kerran valehteli olevan sillä satumaisella
näitäpä kiekuttajia kokonaista kaksitoista… hii… soma poika…
— Jumalan luoma se on kuukin, sanoo Aatami ja nikottelee
Patrakan vahvasta uutisviinasta. — Mutta se on vale, että niitä
muuta on kuin tuo yksi.

— Joo… hiton pitkä vale se on, että… hii… tämäkin maa on


ymmyrkäinen, pannukakku, pallo tahi muu semmoinen piru. Kyllä
Hiertiäinen tietää sen asian.

Turakka istuu synkkänä ja kuuntelee ukkojen jaarituksia. Syysilta


painaa käsittämättömästi häntä, korven huuhkainta, jota lain koura
haparoi, saamatta kynsiinsä, turmanlintua, paikasta paikkaan
lentävää.

Patrakka kynii partaansa eikä sure tämän matoisen maailman


kierouksia eikä kehnouksia. Juo silloin kun janottaa ja on taas pitkät
ajat maistamatta. Keittää vain isännille ja käärii rahaa liiviinsä. Jättää
kohta koko puuhan ja ottaa sen tytön sieltä eräästä kylästä ja laittaa
mökin. Suonien kiivas sykintä on alkanut jo asettua, ja kulkurielämä
ei enää viehätä. No, se onkin sen tytön, pellavahiuksisen ja
punaposkisen ansio.

Saunasta on lakannut savu tuprahtelemasta, ja valtava hiilos


hehkuu ja lämmittää avonaisesta ovesta nurmella istuvia miehiä,
jotka siinä jaarittelevat ihmeitään, viinan punerrus naamassa.

— … minultakin kerran käytyä siellä Helsingissä, helevetissä, —


valehtelee Hiertiäinen silmät kiiluen, — ja sielläkös vasta… hii
herratkin kuin harakoita, pyrstönutuissa ja muissa hepenissä. Heh,
ryötöillä niin rento kaula, että semmoisten valkoisten lastojen
varassa. Ja akat niinkuin riikinkukot… hyvältä haisevia, piiatkin,
pyntätyitä ja rasvatulta… hii… minä heitä tunnustelemaan tällä
suonisella kouralla, että ovatko lihavia, niin suututaan ja säkätetään.
Minä en kuin nauran niille ja sanon, että on tässä ennenkin jo
akkojen kanssa lupsuteltu… osataan tanssittaakin… hii… poliisi
hätyyttelemään, häikäle, ja komentamaan… minä ryypyt sille tästä
litteästä matista, tätä ryytiviinaa, niin paikalla kuin lammas… neuvoo
ja viittilöi… ei muka keskikatua kävellä, kun ne sähköt ja säkyttimet…
heh… herroja ja hempukoita siellä niinkuin itikoita, pythyi! Parempi
täällä omassa saunassa, enkä tätä heijän helesinkilöihinsä vaihtaisi.

Sauna alkaa joutua. Maistetaan. Nostetaan kokonainen


viinatynnyri saunan eteen ja istutaan vielä ympärille. Kerkiääpä sinne
saunaan vielä. On elokuista iltaa, kun kerran kuukin paistaa.
Puhutaan näistä maaliman asioista, viisaillaan.

Hiertiäinen suu mareessa miettii. Sanoo:

— On nekin rautatiet… sätkyttimet…juoksutettu seernoja kuin


vasikan suolia pitkin teitä, ja sitten nämä herrat ajaa… suurilla
rahoillaan… heh… ja sitten kaupuntloita laitetaan, pesiä .. hii.. jossa
hempukoihen kanssa heiskataan… eipäs ollut ryötöillä ryytiviinaa…
kuuluvat nekin lakiherrat pulituuria juovan… ii… Annahhan, Antti, se
puteli tänne, kun lekkeristä lirutetaan.

Aatamikin nikottelee:

— Ne sähköt ja vaunut… hik… niitä viimeisen lopun merkkejä…


tämän maaliman ruhtinas… hik… perkele… niitä laitattaa ja ajattaa…
lapsillaan, luoduilla ja lunastetuilla. Mutta kun näitä… hurskaita… niin
säästetään … jos tekisivät parannuksen… armon ajassa.

Aatami on nauttinut jumalanviljaa niin, että silmät alkavat painua


kiinni ja ääni marittaa ja naukuu kuin keväisen kissan. Hiertiäinen,
korven piru, ei tietääkseenkään. Nauraa Kenkkulaiselle, joka aina sitä
uskoaan ja vanhurskauttaan, näinkin uutisviinojen juhlassa. Törisee
Aatamille, toisten jo saunaan riisuutuessa:

— Elä sinä Aatu aina sitä samaa… armosta ja muusta… tuntuu


pahalta… ii… kun kerran meillä kummallakin näissä piioissa ja
puteliloissa ne armot ja muut… hii… yhtä hupsu kuin herratkin… sinä
Aatami… puhut paskia.

— Saunaan siitä!

Turakka karjasee, niin että Antti lysähtää takasilleen ja konttaa


nelijalkaisena saunaan.

Joutuvat siitä jo toisetkin, ja Patrakka valelee viinaa kiukaalle.

— Annetaan saunan haltialle uhrinsa ja nostakaa te muut se


viinalekkeri tuohon keskelle lattiaa, kun nyt kerran uutisen juhla, ja
juokaa, juokaa niin, että huomisen päivän vielä mehiläisiä
kuuntelette, ja sittenpä sinäkin Aatami osaat oikein sitä
vanhurskauttasi taas, kun on päästy uutiseen ja saatu tätä rukiisen
nestettä suoniin, ja sinä Antti anna sille reumatille ja kintun kiskojalle
niin, että tulet yhtä nuoreksi kuin viinan jumala, ja sinä Hiertiäinen,
korven punanaamainen piru, ota niin, että suonesi pullottaa kuin
lehmän suolet ja että jaksat vielä sata vuotta lekertää Tiinasi ja
piikojesi kanssa, ja sinä Turakka, uskon veli ja ystävä, vedä henkeesi
yrttiviinan lemua ja lennä taas kuin kulo pitkin kyliä, kunnes oikaiset
sääresi korpikuusen juurelle ja kuuntelet sitä iankaikkista itikkain
laulua. Ja jos nyt sitten laulettaisiin.

Patrakka aloittaa jätkien junttalaulun:


»Iitin Tiltu kun kahvia keitti, niin kasakka kantoi vettä vaan,
hei jei jekkakkaa, kasakka kantoi vettä vaan.»

Muut kaikki, paitsi Aatami, yhtyvät lauluun, ja saunan seiniä


tärisyttää neljän miehen voimalla:

»On sitä oltuna saunassa sekä saunan takana, hei jei


jekkakkaa, sekä saunan takana.»

Hiertiäisellä on piru mielessä. Hän kähnii lavoilta alas, kaataa


lekkeristä viinaa kippoon ja heittää sen kiukaalle, kaataa toisen ja
tyhjentää senkin pihiseville ja paukkaville kiville.

— Elä perkuloita!

— Nyt tuli helvetti!

— Polttaa kuin tuli… ää… vettä…

Saunassa kiertää viinan väkevä, tukahduttava löyly, ja Hiertiäinen


hekottaa alhaalla. Miehet köntistyvät ja putoilevat alas, ensin Aatami
ja sitten Antti, muutaman kerran kolmikulmaisia silmäkolojaan
lupsauttaen ja vetäen viimeisen henkäisyn, Aatami puuskuttaen kuin
uupunut eläin ja viinakuninkaat tajuttomina, lavojen alla rähmällään.

Hiertiäinen hätääntyy, hoippuu ulos ja kantaa kylmää vettä


sangollisen rannasta, syytää sitä vuorotellen jokaisen päähän ja
punoittavalle ruumiille. Viinakuninkaat näyttävät virkoavan, mutta
Aatamin ja Antin vaellus on lopussa.

*****
Hörödii on saanut taaskin nimismiehen lähtemään korpeen, ja
nytpä heillä on varma saalis saunassa, josta viinakuninkaat eivät
jaksa eivätkä arvaa lähteä pakoon.

Hörödii on hyvillään, ja kun kipeäjalkaisen, korpiteillä äkäilevän


nimismiehen kanssa ovat päässeet Asarin saunalle, sanoo hän:

— Jopahan viimeinkin veti kuin naulan päähän. Pitää varoa,


etteivät pääse karkaamaan.

Hörödii jää ase kourassa saunan ovelle, ja nimismies työntyy


ovirenkkanasta sisään.

— Ää… onpa täällä hajua…

Hiertiäinen huomaa ruununmiehet, ottaa vaatteensa ja mitään


puhumatta kähnii ulos. Hörödii estelee, mutta Asari teristyy:

— Mitä sinä… tässä… selvää miestä…

Asari katoaa pihaan, sieltä heinäluuvaan ja tirkistelee katon


kolosta saunalle. On hyvillään, että on päässyt karkuun, no, piru,
selvä mies kuin… minkä ne hänelle…

Nimismies kantaa ensiksi saunasta viinalekkerin varmaan talteen


ja antaa poliisin tehtäväksi kovistella miehiä mukaansa,
viinakuninkaita, joita ei enää käyne laskeminen vapaalle jalalle.

— Ei niissä taida olla enää henkeä jälellä, sanoo Hörödii


nimismiehelle.

— No minkä minä sille… kuuntele korvasta … tai mistä tahansa…

— Tulkaa auttamaan, että saadaan vaatteet päälle.

You might also like