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

(eBook PDF) Absolute Java, 6th Global

Edition by Walter Savitch


Visit to download the full and correct content document:
https://ebooksecure.com/download/ebook-pdf-absolute-java-6th-global-edition-by-walt
er-savitch/
Preface      7

VIDEO NOTES
VideoNotes are step-by-step videos that guide readers through the solution to an end-of-
chapter problem or further illuminate a concept presented in the text. Icons in the text
VideoNote
indicate where a VideoNote enhances a topic. Fully navigable problems allow for self-
paced instruction. VideoNotes are located at www.pearsonglobaleditions.com/savitch.

OTHER FEATURES
Pitfall sections, programming tip sections, and examples of complete programs with
sample I/O are given throughout each chapter. Each chapter ends with a summary
section and a collection of programming projects suitable to assign to students.

How to Access Instructor and Student Resource


Materials
Online Practice and Assessment with . MyProgrammingLab
helps students fully grasp the logic, semantics, and syntax of programming. Through
practice exercises and immediate, personalized feedback, MyProgrammingLab improves
the programming competence of beginning students who often struggle with the basic
concepts and paradigms of popular high-level pro- gramming languages.
A self-study and homework tool, a MyProgrammingLab course consists of hun-
dreds of small practice problems organized around the structure of this textbook. For
students, the system automatically detects errors in the logic and syntax of their code
submissions and offers targeted hints that enable students to figure out what went
wrong—and why. For instructors, a comprehensive gradebook tracks correct and
incorrect answers and stores the code inputted by students for review.
For a full demonstration, to see feedback from instructors and students, or to get
started using MyProgrammingLab in your course, visit www.myprogramminglab.com.

SUPPORT MATERIAL
The following support materials are available to all users of this Global Editions book
at www.pearsonglobaleditions.com/savitch:
■ Source code from the book

The following resources are available to qualified instructors only at www.


pearsonglobaleditions.com/savitch. Please contact your local sales representative for
access information:
■ Instructor’s Manual with Solutions
■ PowerPoint® slides

ACKNOWLEDGMENTS
Numerous individuals have contributed invaluable help and support in making this
book happen: My former editor, Susan Hartman at Addison-Wesley, first conceived of
the idea for this book and worked with me on the first editions; My current ­editor, Matt
8      Preface

Goldstein, provided support and inspiration for getting subsequent editions reviewed,
revised, and out the door; Kelsey Loanes, Rose Kernan, Demetrius Hall, and the other
fine people at Pearson also provided valuable assistance and encouragement.
The following reviewers provided corrections and suggestions for this book. Their
contributions were a great help. I thank them all. In alphabetical order they are:
Jim Adams Chandler-Gilbert Community College
Gerald W. Adkins Georgia College & State University
Dr. Bay Arinze Drexel University
Tamara Babaian Bentley University
James Baldo George Mason University
Prof. Richard G. Baldwin Austin Community College
Kevin Bierre Rochester Institute of Technology
Jon Bjornstad Gavilan College
Janet Brown-Sederberg Massasoit Community College
Tom Brown Texas A&M University, Commerce
Charlotte Busch Texas A&M University, Corpus Christi
Stephen Chandler NW Shoals Community College
Hong Cheng Southern Arkansas University
KY Daisy Fan Cornell University
Adrienne Decker University of Buffalo
Brian Downs Century College
Jeffrey Edgington University of Denver
Keith Frikken Miami University
Ahmad Ghafarian North Georgia College & State University
Arthur Geis College of DuPage
Massoud Ghyam University of Southern California
Susan G. Glenn Gordon College
Nigel Gwee Louisiana State University
Judy Hankins Middle Tennessee State University
May Hou Norfolk State University
Sterling Hough NHTI
Chris Howard DeVry University
Eliot Jacobson University of California, Santa Barbara
Balaji Janamanchi Texas Tech University
Suresh Kalathur Boston University
Edwin Kay Lehigh University
Dr. Clifford R. Kettemborough IT Consultant and Professor
Preface      9

Frank Levey Manatee Community College


Xia Lin Drexel University
Mark M. Meysenburg Doane College
Sridhar P. Nerur The University of Texas at Arlington
Hoang M. Nguyen Deanza College
Rick Ord University of California, San Diego
Prof. Bryson R. Payne North Georgia College & State University
David Primeaux Virginia Commonwealth University
Neil Rhodes University of California, San Diego
W. Brent Seales University of Kentucky
Lili Shashaani Duquesne University
Riyaz Sikora The University of Texas at Arlington
Christopher Simpkins Georgia Tech
Jeff Six University of Delaware
Donald J Smith Community College of Allegheny County
Tom Smith Skidmore College
William Smith Tulsa Community College
Xueqing (Clare) Tang Governors State University
Ronald F. Taylor Wright State University
Thomas VanDrunen Wheaton College
Shon Vick University of Maryland, Baltimore County
Natalie S. Wear University of South Florida
Dale Welch University of West Florida
David A. Wheeler
Wook-Sung Yoo Gannon University

Special thanks goes to Kenrick Mock (University of Alaska Anchorage) who


executed the updating of this edition. He once again had the difficult job of satisfying
me, the editor, and himself. I thank him for a truly excellent job.
 Walter Savitch
Pearson wishes to thank and acknowledge the following people for their work on the
Global Edition:
Contributors
Vikas Deep Dhiman Amity University
Madhurima Hooda Amity University
Reviewers
Manasa Rengarer NMAM Institute of Technology
S.H. Chung Wawasan Open University
Issam A. El-Moughrabi Gulf University of Science and Technology
LOCATION OF VIDEONOTES IN THE TEXT VideoNote
www.pearsonglobaleditions.com/savitch

Chapter 1 Compiling a Java Program, page 42


Solution to Programming Project 1.7, page 88
Chapter 2 Using printf, page 94
Pitfalls Involving nextLine(), page 115
Solution to Programming Project 2.11, page 129
Solution to Programming Project 2.12, page 130
Chapter 3 Nested Loop Example, page 177
Debugging Walkthrough, page 184
Generating Random Numbers, page 191
Solution to Programming Project 3.9, page 202
Solution to Programming Project 3.13, page 203
Chapter 4 Information Hiding Example, page 239
Example Using the StringTokenizer Class on a CSV File, page 279
Solution to Programming Project 4.9, page 287
Chapter 5 Deep Copy vs. Shallow Copy Example, page 353
Solution to Programming Project 5.9, page 376
Chapter 6 Arrays of Objects, page 390
Solution to Programming Project 6.8, page 454
Solution to Programming Project 6.15, page 456
Chapter 7 Inheritance Walkthrough, page 464
Solution to Programming Project 7.3, page 509
Solution to Programming Project 7.5, page 511
Chapter 8 Late Binding Example, page 518
Solution to Programming Project 8.1, page 550
Solution to Programming Project 8.9, page 553
Chapter 9 Solution to Programming Project 9.1, page 609
Solution to Programming Project 9.7, page 611
Chapter 10 Reading a Text File, page 625
Solution to Programming Project 10.1, page 679
Solution to Programming Project 10.9, page 681
Chapter 11 Recursion and the Stack, page 696
Solution to Programming Project 11.3, page 720
Chapter 12 Solution to Programming Project 12.9, page 746
Chapter 13 Solution to Programming Project 13.1, page 790
Solution to Programming Project 13.11, page 793
Chapter 14 Solution to Programming Project 14.7, page 836
Chapter 15 Walkthrough of the Hash Table Class, page 906
Solution to Programming Project 15.1, page 931
Chapter 16 Using HashMap with a Custom Class, page 948
Solution to Programming Project 16.3, page 975
Solution to Programming Project 16.5, page 976
Chapter 17 GUI Layout Using an IDE, page 1009
Solution to Programming Project 17.1, page 1053
Chapter 18 Walkthrough of a Simple Drawing Program, page 1082
Solution to Programming Project 18.7, page 1117
Chapter 19 Walkthrough of a Program with Race Conditions, page 1134
Networking with Streams, page 1138
Functional Programming Example, page 1172
Solution to Programming Project 19.3, page 1196
Solution to Programming Project 19.11, page 1197
Chapter 20 No video notes (Chapter on website)
This page intentionally left blank
Brief Contents

Chapter 1 Getting Started  33


Chapter 2 Console Input and Output  89
Chapter 3 Flow of Control 131
Chapter 4 Defining Classes I 205
Chapter 5 Defining Classes II 291
Chapter 6 Arrays 377
Chapter 7 Inheritance 459
Chapter 8 Polymorphism and Abstract Classes  515
Chapter 9 Exception Handling  555
Chapter 10 File I/O 613
Chapter 11 Recursion 683
Chapter 12 UML and Patterns  725
Chapter 13 Interfaces and Inner Classes  747
Chapter 14 Generics and the ArrayList Class  795
Chapter 15 Linked Data Structures  839
Chapter 16 Collections, Maps and Iterators  935
Chapter 17 Swing I 981
Chapter 18 Swing II 1057
Chapter 19 Java Never Ends  1119
Chapter 20 Applets and HTML  (online at
www.pearsonglobaleditions.com/savitch)
Appendix 1 Keywords 1199
Appendix 2 Precedence and Associativity Rules  1201
Appendix 3 ASCII Character Set  1203
Appendix 4 Format Specifications for printf 1205
Appendix 5 Summary of Classes and Interfaces  1207
Index 1275

     13
This page intentionally left blank
Contents

Chapter 1 Getting Started 33

1.1 Introduction to Java  34


Origins of the Java Language ★ 34
Objects and Methods 35
Applets ★ 36
A Sample Java Application Program 37
Byte-Code and the Java Virtual Machine 40
Class Loader ★ 42
Compiling a Java Program or Class 42
Running a Java Program 43
TIP: Error Messages 44

1.2 Expressions and Assignment Statements  45


Identifiers 45
Variables 47
Assignment Statements 48
TIP: Initialize Variables 50
More Assignment Statements ★ 51
Assignment Compatibility 52
Constants 53
Arithmetic Operators and Expressions 55
Parentheses and Precedence Rules ★ 56
Integer and Floating-Point Division 58
PITFALL: Round-Off Errors in Floating-Point Numbers 59
PITFALL: Division with Whole Numbers 60
Type Casting 61
Increment and Decrement Operators 62

1.3 The Class String 65


String Constants and Variables 65
Concatenation of Strings 66
Classes 67
String Methods 69
Escape Sequences 74
String Processing 75
The Unicode Character Set ★ 75

     15
16      Contents

1.4 Program Style 78


Naming Constants 78
Java Spelling Conventions 80
Comments 81
Indenting 82

Chapter Summary 83
Answers to Self-Test Exercises 84
Programming Projects 86

Chapter 2 Console Input and Output 89

2.1 Screen Output 90


System.out.println 90
TIP: Different Approaches to Formatting Output 93
Formatting Output with printf 93
TIP: Formatting Monetary Amounts with printf 97
TIP: Legacy Code 98
Money Formats Using NumberFormat ★ 99
Importing Packages and Classes 102
The DecimalFormat Class ★ 104

2.2 Console Input Using the Scanner Class  108


The Scanner Class 108
PITFALL: Dealing with the Line Terminator, '\n' 115
The Empty String 116
TIP: Prompt for Input 116
TIP: Echo Input 116
Example: Self-Service Checkout 118
Other Input Delimiters 119

2.3 Introduction to File Input 121


The Scanner Class for Text File Input 121

Chapter Summary 124


Answers to Self-Test Exercises 124
Programming Projects 127

Chapter 3 Flow of Control 131

3.1 Branching Mechanism 132


if-else Statements 132
Omitting the else 133
Compound Statements 134
TIP: Placing of Braces 135
Nested Statements 136
Contents      17

Multiway if-else Statement 136


Example: State Income Tax 137
The switch Statement 139
PITFALL: Forgetting a break in a switch Statement 143
The Conditional Operator ★ 144

3.2 Boolean Expressions 145


Simple Boolean Expressions 145
PITFALL: Using = in Place of == 146
PITFALL: Using == with Strings 147
Lexicographic and Alphabetic Order 148
Building Boolean Expressions 151
PITFALL: Strings of Inequalities 152
Evaluating Boolean Expressions 152
TIP: Naming Boolean Variables 155
Short-Circuit and Complete Evaluation 156
Precedence and Associativity Rules 157

3.3 Loops 164


while Statement and do-while Statement 164
Algorithms and Pseudocode 166
Example: Averaging a List of Scores 169
The for Statement 170
The Comma in for Statements 173
TIP: Repeat N Times Loops 175
PITFALL: Extra Semicolon in a for Statement 175
PITFALL: Infinite Loops 176
Nested Loops 177
The break and continue Statements ★ 180
The exit Statement 181

3.4 Debugging 182


Loop Bugs 182
Tracing Variables 182
General Debugging Techniques 183
Example: Debugging an Input Validation Loop 184
Preventive Coding 188
Assertion Checks ★ 189

3.5 Random Number Generation ★ 191


The Random Object 191
The Math.random() Method 193

Chapter Summary 194


Answers to Self-Test Exercises 194
Programming Projects 200
18      Contents

Chapter 4 Defining Classes I 205

4.1 Class Definitions  206


Instance Variables and Methods 209
More about Methods 212
TIP: Any Method Can Be Used as a void Method 216
Local Variables 218
Blocks 219
TIP: Declaring Variables in a for Statement 220
Parameters of a Primitive Type 220
PITFALL: Use of the Terms “Parameter” and “Argument” 227
Simple Cases with Class Parameters 229
The this Parameter 229
Methods That Return a Boolean Value 231
The Methods equals and toString 234
Recursive Methods 237
TIP: Testing Methods 237

4.2 Information Hiding and Encapsulation  239


public and private Modifiers 240
Example: Yet Another Date Class 241
Accessor and Mutator Methods 242
TIP: A Class Has Access to Private Members of All Objects of the Class 247
TIP: Mutator Methods Can Return a Boolean Value ★ 248
Preconditions and Postconditions 249

4.3 Overloading 250
Rules for Overloading 250
PITFALL: Overloading and Automatic Type Conversion 254
PITFALL: You Cannot Overload Based on the Type Returned 256

4.4 Constructors 258
Constructor Definitions 258
TIP: You Can Invoke Another Method in a Constructor 266
TIP: A Constructor Has a this Parameter 266
TIP: Include a No-Argument Constructor 267
Example: The Final Date Class 268
Default Variable Initializations 269
An Alternative Way to Initialize Instance Variables 269
Example: A Pet Record Class 270
The StringTokenizer Class ★ 274

Chapter Summary 279


Answers to Self-Test Exercises 280
Programming Projects 285
Contents      19

Chapter 5 Defining Classes II 291

5.1 Static Methods and Static Variables  293


Static Methods 293
PITFALL: Invoking a Nonstatic Method Within a Static Method 295
TIP: You Can Put a main in Any Class 296
Static Variables 300
The Math Class 305
Wrapper Classes 309
Automatic Boxing and Unboxing 310
Static Methods in Wrapper Classes 312
PITFALL: A Wrapper Class Does Not Have a No-Argument Constructor 315

5.2 References and Class Parameters  316


Variables and Memory 317
References 318
Class Parameters 323
PITFALL: Use of = and == with Variables of a Class Type 327
The Constant null 329
PITFALL: Null Pointer Exception 330
The new Operator and Anonymous Objects 330
Example: Another Approach to Keyboard Input ★ 331
TIP: Use Static Imports ★ 333

5.3 Using and Misusing References  335


Example: A Person Class 336
PITFALL: null Can Be an Argument to a Method 341
Copy Constructors 345
PITFALL: Privacy Leaks 347
Mutable and Immutable Classes 351
Tip: Deep Copy versus Shallow Copy 353
TIP: Assume Your Coworkers Are Malicious 354

5.4 Packages and javadoc 354


Packages and import Statements 355
The Package java.lang 356
Package Names and Directories 356
PITFALL: Subdirectories Are Not Automatically Imported 359
The Default Package 359
PITFALL: Not Including the Current Directory in Your Class Path 360
Specifying a Class Path When You Compile ★ 360
Name Clashes ★ 361
Introduction to javadoc ★ 362
Commenting Classes for javadoc ★ 362
Running javadoc ★ 364
20      Contents

Chapter Summary 366


Answers to Self-Test Exercises 367
Programming Projects 371

Chapter 6 Arrays 377

6.1 Introduction to Arrays  378


Creating and Accessing Arrays 379
The length Instance Variable 382
TIP: Use for Loops with Arrays 384
PITFALL: Array Indices Always Start with Zero 384
PITFALL: Array Index Out of Bounds 384
Initializing Arrays 385
PITFALL: An Array of Characters Is Not a String 387

6.2 Arrays and References  388


Arrays Are Objects 388
PITFALL: Arrays with a Class Base Type 390
Array Parameters 390
PITFALL: Use of = and == with Arrays 392
Arguments for the Method main ★ 397
Methods that Return an Array 399

6.3 Programming with Arrays  400


Partially Filled Arrays 401
Example: A Class for Partially Filled Arrays 404
TIP: Accessor Methods Need Not Simply Return Instance Variables 408
The “for-each” Loop ★ 408
Methods with a Variable Number of Parameters ★ 412
Example: A String Processing Example ★ 415
Privacy Leaks with Array Instance Variables 416
Example: Sorting an Array 420
Enumerated Types ★ 424
TIP: Enumerated Types in switch Statements ★ 429

6.4 Multidimensional Arrays  431


Multidimensional Array Basics 431
Using the length Instance Variable 434
Ragged Arrays ★ 435
Multidimensional Array Parameters and Returned Values 435
Example: A Grade Book Class 436

Chapter Summary 442


Answers to Self-Test Exercises 443
Programming Projects 450
Contents      21

Chapter 7 Inheritance 459

7.1 Inheritance Basics  460


Derived Classes 461
Overriding a Method Definition 471
Changing the Return Type of an Overridden Method 471
Changing the Access Permission of an Overridden Method 472
PITFALL: Overriding versus Overloading 473
The super Constructor 474
The this Constructor 476
TIP: An Object of a Derived Class Has More than One Type 477
PITFALL: The Terms Subclass and Superclass 480
Example: An Enhanced StringTokenizer Class ★ 481

7.2 Encapsulation and Inheritance  484


PITFALL: Use of Private Instance Variables from the Base Class 485
PITFALL: Private Methods Are Effectively Not Inherited 486
Protected and Package Access 487
PITFALL: Forgetting about the Default Package 490
PITFALL: A Restriction on Protected Access ★ 490

7.3 Programming with Inheritance  493


TIP: Static Variables Are Inherited 493
TIP: “is a” versus “has a” 493
Access to a Redefined Base Method 493
PITFALL: You Cannot Use Multiple supers 495
The Class Object 496
The Right Way to Define equals 497
TIP: getClass versus instanceof ★ 499

Chapter Summary 504


Answers to Self-Test Exercises 505
Programming Projects 508

Chapter 8 Polymorphism and Abstract Classes 515

8.1 Polymorphism 516
Late Binding 517
The final Modifier 519
Example: Sales Records 520
Late Binding with toString 527
PITFALL: No Late Binding for Static Methods 528
Downcasting and Upcasting 529
PITFALL: Downcasting 533
22      Contents

TIP: Checking to See Whether Downcasting Is Legitimate ★ 533


A First Look at the clone Method 536
PITFALL: Sometimes the clone Method Return Type Is Object 537
PITFALL: Limitations of Copy Constructors ★ 538

8.2 Abstract Classes  541


Abstract Classes 542
PITFALL: You Cannot Create Instances of an Abstract Class 546
TIP: An Abstract Class Is a Type 547

Chapter Summary 548


Answers to Self-Test Exercises 548
Programming Projects 550

Chapter 9 Exception Handling 555

9.1 Exception Handling Basics  557


try-catch Mechanism 557
Exception Handling with the Scanner Class 559
TIP: Exception Controlled Loops 560
Throwing Exceptions 562
EXAMPLE: A Toy Example of Exception Handling 564
Exception Classes 569
Exception Classes from Standard Packages 570
Defining Exception Classes 572
TIP: Preserve getMessage 576
TIP: An Exception Class Can Carry a Message of Any Type 578
Multiple catch Blocks 583
PITFALL: Catch the More Specific Exception First 585

9.2 Throwing Exceptions in Methods  588


Throwing an Exception in a Method 588
Declaring Exceptions in a throws Clause 590
Exceptions to the Catch or Declare Rule 593
throws Clause in Derived Classes 594
When to Use Exceptions 595
Example: Retrieving a High Score 596
Event-Driven Programming ★ 599

9.3 More Programming Techniques for Exception


­Handling  601
PITFALL: Nested try-catch Blocks 601
The finally Block ★ 601
Rethrowing an Exception ★ 603
The AssertionError Class ★ 603
Contents      23

ArrayIndexOutOfBoundsException 604

Chapter Summary 604


Answers to Self-Test Exercises 605
Programming Projects 609

Chapter 10 File I/O 613

10.1 Introduction to File I/O 614


Streams 614
Text Files and Binary Files 615

10.2 Text Files 616


Writing to a Text File 616
PITFALL: A try Block Is a Block 622
PITFALL: Overwriting an Output File 622
Appending to a Text File 623
TIP: toString Helps with Text File Output 624
Reading from a Text File 625
Reading a Text File Using Scanner 625
Testing for the End of a Text File with Scanner 628
Reading a Text File Using BufferedReader 635
TIP: Reading Numbers with BufferedReader 639
Testing for the End of a Text File with BufferedReader 639
Path Names 641
Nested Constructor Invocations 642
System.in, System.out, and System.err 643

10.3 The File Class 645


Programming with the File Class 645

10.4 Binary Files ★ 649


Writing Simple Data to a Binary File 650
UTF and writeUTF 654
Reading Simple Data from a Binary File 655
Checking for the End of a Binary File 660
PITFALL: Checking for the End of a File in the Wrong Way 661
Binary I/O of Objects 662
The Serializable Interface 663
PITFALL: Mixing Class Types in the Same File 666
Array Objects in Binary Files 666

10.5 Random Access to Binary Files ★ 668


Reading and Writing to the Same File 668
PITFALL: RandomAccessFile Need Not Start Empty 674
24      Contents

Chapter Summary 674


Answers to Self-Test Exercises 675
Programming Projects 679

Chapter 11 Recursion 683

11.1 Recursive void Methods  685


Example: Vertical Numbers 685
Tracing a Recursive Call 688
A Closer Look at Recursion 691
PITFALL: Infinite Recursion 693
Stacks for Recursion ★ 694
PITFALL: Stack Overflow ★ 696
Recursion versus Iteration 696

11.2 Recursive Methods That Return a Value  697


General Form for a Recursive Method That Returns a Value 698
Example: Another Powers Method 698

11.3 Thinking Recursively  703


Recursive Design Techniques 703
Binary Search ★ 704
Efficiency of Binary Search ★ 710
Example: Finding a File 712

Chapter Summary 715


Answers to Self-Test Exercises 715
Programming Projects 720

Chapter 12 UML and Patterns 725

12.1 UML 726


History of UML 727
UML Class Diagrams 727
Class Interactions 728
Inheritance Diagrams 728
More UML 730

12.2 Patterns ★ 731


Adaptor Pattern ★ 731
The Model-View-Controller Pattern ★ 732
EXAMPLE: A Sorting Pattern 733
Restrictions on the Sorting Pattern 739
Efficiency of the Sorting Pattern ★ 739
Another random document with
no related content on Scribd:
1.E.5. Do not copy, display, perform, distribute or redistribute
this electronic work, or any part of this electronic work, without
prominently displaying the sentence set forth in paragraph 1.E.1
with active links or immediate access to the full terms of the
Project Gutenberg™ License.

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

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


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

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


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

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

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


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

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


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

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

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


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

1.F.

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


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

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


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

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


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

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


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

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


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

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


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

Section 2. Information about the Mission of


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

Volunteers and financial support to provide volunteers with the


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

Section 3. Information about the Project


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

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


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

Section 4. Information about Donations to


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

The Foundation is committed to complying with the laws


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

While we cannot and do not solicit contributions from states


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

International donations are gratefully accepted, but we cannot


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

Please check the Project Gutenberg web pages for current


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

Section 5. General Information About Project


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

Project Gutenberg™ eBooks are often created from several


printed editions, all of which are confirmed as not protected by
copyright in the U.S. unless a copyright notice is included. Thus,
we do not necessarily keep eBooks in compliance with any
particular paper edition.

Most people start at our website which has the main PG search
facility: www.gutenberg.org.

This website includes information about Project Gutenberg™,


including how to make donations to the Project Gutenberg
Literary Archive Foundation, how to help produce our new
eBooks, and how to subscribe to our email newsletter to hear
about new eBooks.

You might also like