100% found this document useful (1 vote)
26 views

Java Programming for Engineers 1st Edition Julio Sanchez download

The document provides information about the book 'Java Programming for Engineers' by Julio Sanchez and Maria P. Canton, detailing its content structure, including chapters on Java fundamentals, programming concepts, and object-oriented programming. It also includes links to various related programming and engineering ebooks. The book is published by CRC Press and is aimed at engineers learning Java.

Uploaded by

qanitmufydh
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
26 views

Java Programming for Engineers 1st Edition Julio Sanchez download

The document provides information about the book 'Java Programming for Engineers' by Julio Sanchez and Maria P. Canton, detailing its content structure, including chapters on Java fundamentals, programming concepts, and object-oriented programming. It also includes links to various related programming and engineering ebooks. The book is published by CRC Press and is aimed at engineers learning Java.

Uploaded by

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

Java Programming for Engineers 1st Edition Julio

Sanchez pdf download

https://ebookname.com/product/java-programming-for-engineers-1st-
edition-julio-sanchez/

Get Instant Ebook Downloads – Browse at https://ebookname.com


Instant digital products (PDF, ePub, MOBI) available
Download now and explore formats that suit you...

The PC Graphics Handbook 1st Edition Julio Sanchez

https://ebookname.com/product/the-pc-graphics-handbook-1st-
edition-julio-sanchez/

MATLAB Programming for Engineers 3rd Edition Stephen J.


Chapman

https://ebookname.com/product/matlab-programming-for-
engineers-3rd-edition-stephen-j-chapman/

Groovy Programming An Introduction for Java Developers


1st Edition Kenneth Barclay

https://ebookname.com/product/groovy-programming-an-introduction-
for-java-developers-1st-edition-kenneth-barclay/

Programming and Problem Solving with Java 1st edition


Edition Nell B. Dale

https://ebookname.com/product/programming-and-problem-solving-
with-java-1st-edition-edition-nell-b-dale/
Building Wealth Buying Foreclosures 1st Edition John
Schaub

https://ebookname.com/product/building-wealth-buying-
foreclosures-1st-edition-john-schaub/

Closed Loop Neuroscience 1st Edition Ahmed El Hady

https://ebookname.com/product/closed-loop-neuroscience-1st-
edition-ahmed-el-hady/

Pathfinder Adventure Path Punks in a Powder Keg Outlaws


of Alkenstar 1 Of 3 P2 2nd Edition Vanessa Hoskins

https://ebookname.com/product/pathfinder-adventure-path-punks-in-
a-powder-keg-outlaws-of-alkenstar-1-of-3-p2-2nd-edition-vanessa-
hoskins/

The Handbook of Contemporary Animism 1st Edition Graham


Harvey

https://ebookname.com/product/the-handbook-of-contemporary-
animism-1st-edition-graham-harvey/

The Coretta Scott King Awards 1970 2009 40th


Anniversary Coretta Scott King Awards Book 4th Edition
Henrietta M. Smith

https://ebookname.com/product/the-coretta-scott-king-
awards-1970-2009-40th-anniversary-coretta-scott-king-awards-
book-4th-edition-henrietta-m-smith/
An apocryphal dictionary of psychoanalysis 1st Edition
Giuseppe Civitarese

https://ebookname.com/product/an-apocryphal-dictionary-of-
psychoanalysis-1st-edition-giuseppe-civitarese/
JAVA
Programming
for Engineers

© 2002 by CRC Press LLC


JAVA
Programming
for Engineers
JULIO SANCHEZ
Minnesota State University, Mankato

MARIA P. CANTON
Minnesota State University, Mankato

CRC PR E S S
Boca Raton London New York Washington, D.C.

© 2002 by CRC Press LLC


0810_disclaimer Page 1 Tuesday, May 14, 2002 11:47 AM

Library of Congress Cataloging-in-Publication Data

Sanchez, Julio, 1938-


Java programming for engineers / Julio Sanchez, Maria P. Canton.
p. cm.—(Mechnical engineering)
ISBN 0-8493-0810-0 (alk. paper)
1. Java (Computer program language) 2. Mechanical engineering—Data processing. I.
Canton, Maria P. II. Title. III. Mechanical engineering series (Boca Raton, Fla.)

QA76.76.J38 S26 2002


005.13¢3—dc21 2002025924

This book contains information obtained from authentic and highly regarded sources. Reprinted material
is quoted with permission, and sources are indicated. A wide variety of references are listed. Reasonable
efforts have been made to publish reliable data and information, but the author and the publisher cannot
assume responsibility for the validity of all materials or for the consequences of their use.

Neither this book nor any part may be reproduced or transmitted in any form or by any means, electronic
or mechanical, including photocopying, microfilming, and recording, or by any information storage or
retrieval system, without prior permission in writing from the publisher.

The consent of CRC Press LLC does not extend to copying for general distribution, for promotion, for
creating new works, or for resale. Specific permission must be obtained in writing from CRC Press LLC
for such copying.

Direct all inquiries to CRC Press LLC, 2000 N.W. Corporate Blvd., Boca Raton, Florida 33431.

Trademark Notice: Product or corporate names may be trademarks or registered trademarks, and are
used only for identification and explanation, without intent to infringe.

Visit the CRC Press Web site at www.crcpress.com

© 2002 by CRC Press LLC

No claim to original U.S. Government works


International Standard Book Number 0-8493-0810-0
Library of Congress Card Number 2002025924
Printed in the United States of America 1 2 3 4 5 6 7 8 9 0
Printed on acid-free paper

© 2002 by CRC Press LLC


Color profile: Hewlett Packard - DeskJet 1100C (premium)
Composite Default screen

Table of Contents

Preface

Part I - Java Language Fundamentals

Chapter 1 - Java Programming


Introducing Java
The Portability Issue
Java as a programming language
Java is object-oriented
Java is strongly-typed
Java is similar to C++
Java uses libraries
Java is an interpreted language
Java Code
Communicating with an alien intelligence
Flowcharting

Chapter 2 - Your First Java Program


Installing the JDK
Selecting an Editor
The HelloJava Program
Java language rules
The program header
The HelloJava code
Creating the HelloJava Program

Chapter 3 - How Computers Store Information


Storing Text and Numbers
Number Systems
Binary numbers
Hex numbers
Computer memory
Character data

© 2002 by CRC Press LLC

E:\Java for Engineers\VP Publication\Java for Engineers Final.vp


Thursday, May 16, 2002 9:50:51 PM
Color profile: Hewlett Packard - DeskJet 1100C (premium)
Composite Default screen

Numeric data

Chapter 4 - Storing and Naming Data


A Data-Processing Machine
What is Computer Data?
Identifiers
Creating and using variables and constants
Java variable types
Declaring a variable
Java strings
Java constants
Classification of Java Data
Numeric data
Character data
Boolean data
Type Conversions
Implicit conversions
Type-casting
Declaring literals

Chapter 5 - Performing Input and Output


Input and Output
Data Input
Data Output
Escape characters
A Sample Program

Chapter 6 - Introducing Arrays


A New Data Type
Java Arrays
Creating an array
The array brackets
Accessing array elements
The size of an array
Multi-dimensional arrays
Ragged arrays
Initializing multi-dimensional arrays

Chapter 7 - Java Operators


The Action Element
Operators
Operator action
The Assignment Operator

© 2002 by CRC Press LLC

E:\Java for Engineers\VP Publication\Java for Engineers Final.vp


Thursday, May 16, 2002 9:50:51 PM
Color profile: Hewlett Packard - DeskJet 1100C (premium)
Composite Default screen

The two sides of an assignment


Arithmetic Operators
The remainder operator
Concatenation
Increment and Decrement
Relational Operators

Chapter 8 - Other Java Operators


Logical Operations
Manipulating bits
The & operator
The | operator
The ^ operator
The ~ operator
The <, >, and >> operators
The compound assignment operators
Operator hierarchy
Associativity rules

Chapter 9 - Directing Program Flow


Simple Decisions
Java Decisions Constructs
The if construct
Statement blocks
The nested if
The else construct
The dangling else
Else-if clause
The switch construct
Conditional Expressions

Chapter 10 - Controlling Program Flow


Repetition in Programs
Loops and iterations
Elements of a program loop
For Loop
Compound statement in loops
While loop
Do-While Loop

Chapter 11- Programming with Loops


Java Loop Constructs
Selecting a Loop Construct

© 2002 by CRC Press LLC

E:\Java for Engineers\VP Publication\Java for Engineers Final.vp


Thursday, May 16, 2002 9:50:51 PM
Color profile: Hewlett Packard - DeskJet 1100C (premium)
Composite Default screen

Direct Flow Control


Using break in loops
The continue keyword
The labeled break

Chapter 12 - Program Building Blocks


The Java Subprogram
Modules and Methods
The Elements of a Method
Declaration
Access specifier
Modifier
Return type
Method name
Parameter list

Chapter 13 - Using Methods


The Method Call
Returning from a Method
Arguments and Parameters
Methods and Global Variables
Passing by Value and by Reference

Chapter 14 - Object-Oriented Programming


Classes and Objects
The Why and Wherefore of OO
Object-Oriented Fundamentals
From Problem to Solution
Learning about Classes and Objects
The fundamental principles
Encapsulation
Inheritance
Modeling with Classes
Polymorphism and Abstract Classes
A classification example

Chapter 15 - Object-Oriented Coding


Working with Classes and Objects
Thinking Objects
Object instantiation
Field variables and method variables
Object variables and class variables

© 2002 by CRC Press LLC

E:\Java for Engineers\VP Publication\Java for Engineers Final.vp


Thursday, May 16, 2002 9:50:52 PM
Color profile: Hewlett Packard - DeskJet 1100C (premium)
Composite Default screen

Building Objects
The default constructor
Overloading the constructor

Chapter 16 - Using Inheritance


Inheritance and Data Abstraction
Java Inheritance
Extending class functionality
Polymorphism
Modeling with inheritance
Abstraction and Inheritance
Programming with abstract classes

Chapter 17 - Object Composition


An Alternative to Inheritance
Inheritance Drawbacks
Reusing Class Functionality
The new mind set
Thinking object composition
Aggregation
Objects as Parameters
Acquaintance Associations
Combining Inheritance and Composition
Arrays of objects
Dynamic Binding

Chapter 18 - I/O Programming


Java Input and Output
Obtaining and Transmitting Data
Character data
java.io Package
Streams
Java InputStream class
Java OutputStream class
Standard Streams
The Keyin Class
Flushing the input stream
Obtaining character data
Obtaining numeric data

Chapter 19 - Handling Errors


Program Errors

© 2002 by CRC Press LLC

E:\Java for Engineers\VP Publication\Java for Engineers Final.vp


Thursday, May 16, 2002 9:50:52 PM
Color profile: Hewlett Packard - DeskJet 1100C (premium)
Composite Default screen

Error Types
Hardware and software errors
Algorithmic errors
Exceptions
Bullt-in exception handling
Java's approach
Java exception classes
Advertising exceptions
Exceptions Programming
Java exception processing
Raising exceptions
Handling exceptions
Throwing exceptions

Part II - Java Programming for Engineers

Chapter 20 - Computer Number Systems


The Hindu-Arabic Numerals
Computer Number Systems
Radix or base
Types of Numbers
Whole numbers
Signed numbers
Rational and irational numbers
Real and complex numbers
Storage of Numerical Data
Computer word size
Representing Integers
Sign-magnitude integers
Radix-complement integers
Diminished-radix integers
Representing Fractional Numbers
Fixed-point representations
Floating-point representations
Standardized floating-point formats
Binary-Coded Decimals (BCD)
Floating-point BCD

Chapter 21- Fixed-Precision Numeric Data


Java Numeric Data Types
Primitive Data Types
IEEE 754 Standard
Numeric Data Encoding
Rounding

© 2002 by CRC Press LLC

E:\Java for Engineers\VP Publication\Java for Engineers Final.vp


Thursday, May 16, 2002 9:50:52 PM
Color profile: Hewlett Packard - DeskJet 1100C (premium)
Composite Default screen

Interval arithmetic
Treatment of infinity
Not a number (NaN)
Signaling and quiet NaNs
Exceptions
Invalid operation exception
Division by zero exception
Overflow exception
Underflow exception
Inexact result exception
IEEE 754 in Java
java.lang Class Double
MAX_VALUE
MIN_VALUE
NaN
NEGATIVE_INFINITY
POSITIVE_INFINITY
public static boolean isInfinite(double v)
public boolean isInfinite()
public static boolean isNaN(double v)
public boolean isNaN()
java.lang Class Float
MAX_VALUE
MIN_VALUE
NaN
NEGATIVE_INFINITY
POSITIVE_INFINITY
public static boolean isInfinite(float v)
public boolean isInfinite()
public static boolean isNaN(float v)
public boolean isNaN()
Java Numeric Truncation
public static double ceil(double a)
public static double floor(double a)
public static double rint(double a)
public static long round(double a)
public static int round(float a)

Chapter 22 - Variable-Precision Numeric Data


High-Precision Arithmetic
BigDecimal Numbers
BigDecimal constructors
BigDecimal(BigInteger val)
BigDecimal(BigInteger unscaledVal, int scale)
BigDecimal(double val)
BigDecimal(String val)

© 2002 by CRC Press LLC

E:\Java for Engineers\VP Publication\Java for Engineers Final.vp


Thursday, May 16, 2002 9:50:52 PM
Color profile: Hewlett Packard - DeskJet 1100C (premium)
Composite Default screen

Using the BigDecimal constructors


BigDecimal scale operations
SetScale() method
Scale() method
BigDecimal point operations
BigDecimal comparisons and conversions
public boolean equals(Object x)
public int compareTo(BigDecimal val)
public double doubleValue()
public float floatValue()
public int intValue()
public long longValue()
public BigInteger toBigInteger()
public static BigDecimal valueOf(long unscaledVal, int scale)
public static BigDecimal valueOf(long val)
public String toString()
public int hashCode()
BigDecimal rounding controls
BigDecimal Arithmetic
A sample program
The BigInteger Class
BigInteger numbers
BigInteger constructors
BigInteger(byte[] val)
BigInteger(int signum, byte[] magnitude)
BigInteger(int bitLength, int certainty, Random rnd)
BigInteger(int numBits, Random rnd)
BigInteger(String val)
BigInteger(String val, int rdix)
BigInteger methods
A sample program

Chapter 23 - Fundamental Operations


Calculator Operations
Java Floating-Point Math
Strict and non-strict math
Java Basic Arithmetic
Numeric constants
public static final double E
public static final double PI
Absolute value
public static int abs(int a)
public static long abs(long a)
public static float abs(float a)
public static double abs(double a)
Maximum and minimum

© 2002 by CRC Press LLC

E:\Java for Engineers\VP Publication\Java for Engineers Final.vp


Thursday, May 16, 2002 9:50:53 PM
Color profile: Hewlett Packard - DeskJet 1100C (premium)
Composite Default screen

public static operand max(operand a, operand b)


public static operand min(operand a, operand b)
Rounding controls
public static double ceil(double a)
public static double floor(double a)
public static double rint(double a)
public static int round(float a)
public static long round(double a)
IEEE-style remainder
public static double IEEEremainder(double f1, double f2)
Exponential Function
public static double pow(double a, double b)
public static double sqrt(double a)
public static double exp(double a)
Trigonometric Functions
Calculating trigonometric functions
Hyperbolic functions and arc-functions
Cartesian and polar coordinates
Logarithmic Functions
Calculating antilogarithms
Random Numbers
Producing pseudo-random numbers
public static double random()

Chapter 24 - Java Math for Engineers


Java Numerical Primitives
Factorial
Evaluating Numeric Results
Floating-point errors
Comparing Floating-Point Numbers
Comparisons in IEEE 754
Weighted comparisons
Bit-by-Bit operations
public static long doubleToLongBits(double value)
public static long doubleToRawLongBits(double value)
public static double longBitsToDouble(long bits)
Conversion Operations
Integer and fractional parts
Solving Triangles
Pythagoras’ theorem
Side-angle problems
Solving Quadratic equations

Chapter 25 - Introducing Computer Graphics


Developing Graphical Applications

© 2002 by CRC Press LLC

E:\Java for Engineers\VP Publication\Java for Engineers Final.vp


Thursday, May 16, 2002 9:50:53 PM
Color profile: Hewlett Packard - DeskJet 1100C (premium)
Composite Default screen

Origin of Computer Graphics


Text-based and graphical systems
Event-Driven Programming
Event manager and event handler
The Main Window
Controls

Chapter 26 - Java Graphics


The Greatest Challenge
Applets and applications
The Java Foundation Classes
AWT
Swing
Java 2D
The Frame Concept
AWT frame class
Window class
Container class
The Java Graphics Application
The ActiveFrame class
The Display Context
The update() and paint() methods
Manipulating fonts

Chapter 27 - Displaying Graphic Images


Vector and Raster Graphics
The frame origin
Color and Java graphics
RGB color designation
The Java Graphics Class
Vector-Based Drawing
Transformations
Raster Graphics
The image object
Displaying the bitmap

© 2002 by CRC Press LLC

E:\Java for Engineers\VP Publication\Java for Engineers Final.vp


Thursday, May 16, 2002 9:50:53 PM
Color profile: Hewlett Packard - DeskJet 1100C (premium)
Composite Default screen

Preface

This book about Java programming is designed to address the needs of en-
gineers, scientists, and technology professionals in general. In identifying
our target audience we have made several assumptions:
1. Our readers are not likely to use Java to develop applications of major com-
plexity. Instead, we envision that the programs would be relatively small
and specialized towards the solution of a particular problem set of a tech-
nological field.
2. Our audience is more concerned with the solution of numerical problems
than with text processing or the crunching of alphabetic data.
3. The typical development environment consists of a single programmer or a
small programming team.
4. Most of the programs will be used by an individual or by a small technical
group.
5. The programs and applications will not be marketed to the public at large.
Based on these assumptions we have focused our attention on those
topics in Java programming that are of greater interest to our audience.
At the same time, we have minimized the coverage of topics that are of
less concern to the typical engineer-programmer.

On the other hand, Java is a general-purpose programming language;


therefore, it cannot be easily partitioned for the convenience of a particu-
lar interest group. Java programmers must deal with data types, opera-
tors and keywords, methods, classes, input and output, error handling,
and a host of other necessary topics. This language core is necessary
whatever the purpose of the application.

Contents
The book aims at a comprehensive coverage of Java 1.3 as a full-featured
programming language, using the PC platform. The text assumes no prior
programming experience. The only skills expected in the reader are basic

© 2002 by CRC Press LLC

E:\Java for Engineers\VP Publication\Java for Engineers Final.vp


Thursday, May 16, 2002 9:50:54 PM
Color profile: Hewlett Packard - DeskJet 1100C (premium)
Composite Default screen

keyboarding and user-level familiarity with the PC. The material is sprin-
kled with short Java programs and code fragments that illustrate the point
at hand. The sample programs are stripped of all unnecessary complica-
tions and distracting details, however, most of them stand alone as small
applications. The purpose of the sample programs is to provide a valid, run-
ning sample that can be reused in your own code.

The text covers the following topics:


• Java programming language fundamentals
• Object oriented programming in Java
• Error handling
• Computer number systems
• Fixed and variable precision numeric data
• Numerical primitives
• Computer graphics in Java
The book is divided in two parts. The first one is a description of the
Java language, of the fundamentals of object orientation, input and out-
put operations, and error handling. The second part is about Java pro-
gramming for engineers. It starts with computer number systems, fixed-
and variable-precision numeric data, mathematical programming in Java
as could be of interest to engineers, and concludes with an overview of
Java graphics.

© 2002 by CRC Press LLC

E:\Java for Engineers\VP Publication\Java for Engineers Final.vp


Thursday, May 16, 2002 9:50:54 PM
Color profile: Disabled
Composite Default screen

Part I

Java Language Fundamentals

© 2002 by CRC Press LLC

E:\Java for Engineers\VP Publication\Java for Engineers.vp


Thursday, April 25, 2002 9:27:36 AM
Color profile: Disabled
Composite Default screen

Chapter 1

Java Programming

Introducing Java
Java is a programming language similar to C and C++. Its most characteris-
tic feature is that Java is a platform-independent language. This means that
Java programs will run on any machine that supports the language. The slo-
gan “write once, run anywhere” has often been used to describe and pro-
mote the Java language.

Incidentally...
Java is not without drawbacks, and platform-independency is more a
goal than a reality. Often Java programs must be modified before they
operate correctly in another system. This has led some critics to re-
write the Java slogan to say “write once, debug everywhere.”

Java was conceived by James Gosling, in the early 1990s, as a simple


and small language to be used in programming consumer electronic de-
vices, such as cellular phones and TV controllers. It was originally named
Oak. After a few years of vainly attempting to find a costumer for Oak
(also called Green), the design team renamed the language Java and in-
corporated it into the HotJava browser. HotJava could be used to down-
load and run small programs, called applets, from the web. Applets,
written in Java, provided a variety of animation and user-interaction fea-
tures that were not available in a conventional browser. In the summer of
1995, Sun Microsystems released Java as a programming language. It was
an instant success. In a few months Java became the preferred program-
ming language of the World Wide Web, and it still is. It also evolved into a
popular, general-purpose programming language.

© 2002 by CRC Press LLC

E:\Java for Engineers\VP Publication\Java for Engineers.vp


Thursday, April 25, 2002 9:27:37 AM
Color profile: Disabled
Composite Default screen

Perhaps the most important element in Java’s success was its timeli-
ness. The language was introduced at the same time that the World Wide
Web was rapidly gaining popularity. The Web is an international network
of incompatible computers, made by dozens of manufacturers and having
unique hardware characteristics. There is no standard operating system
or software environment on the Web.

Java brought a promise of uniformity and compatibility to this diverse


hardware and software environment of often irreconcilable differences.
Its promise was that a program written in the Java language would exe-
cute correctly on any Java-enabled machine. A Java programmer could
code a small application, embed it in a Web page, and the program would
run on any browser that supported Java.

Programmers note:
The language used to create Web pages and other Internet documents
is called Hypertext Markup Language (HTML). Java code can be em-
bedded in HTML documents in a capsule called a Java applet.

Java also provides a way of extending the functionality of a Web


browser. Using Java, you can create a Web page that does more than is
possible with straight HTML. The processing is contained in a Java applet
that runs on any Java-enabled browser, including Mosaic, Netscape Navi-
gator, or Internet Explorer. The applet executes correctly on a PC run-
ning Windows, on a Macintosh, on a UNIX machine, or on an IBM
mainframe. The result is the same if you are connected to the Internet
through a high-speed network or a slow-speed modem. This is what
makes Java powerful and unique.

The Portability Issue


In computer talk, the word “portable” describes code that can be moved to
various systems with little or no effort. The expression probably relates to a
computer connection, called a port, that is used for passing data in and out
of a machine. Code that can be made to work in another machine simply by
sending it through ports, is said to be portable. A programming language,
such as Java, that can be easily made to run on various systems is described
as highly portable.

Originally, Java’s portability was limited to applets intended for the


Web. It was soon noticed that Java could be used as a full-featured pro-
gramming language to develop complete applications. The resulting pro-
grams would be portable to any Java-supporting platform. The benefits of

© 2002 by CRC Press LLC

E:\Java for Engineers\VP Publication\Java for Engineers.vp


Thursday, April 25, 2002 9:27:37 AM
Color profile: Disabled
Composite Default screen

machine-independent programming went beyond the obvious problems


of hardware incompatibility. In the rapidly-evolving world of personal
computers, operating systems were also changing at a fast rate. In the
1990’s the same machine could run a half dozen versions of MS DOS, Win-
dows 3.0/3.1, Windows 95, Windows 98, Windows 2000, NT 3.1, 3.5, 4.0, or
Windows CE, and Linux. Applications had to be constructed taking into
account many variations in the system software. At the same time, many
potential customers were lost when an application was limited to a single
machine or operating system environment.

Making an application compatible with several machine and software


configurations often ends in a programming nightmare. Java promises a
simplification of the programming task and a solution to incompatibility
problems. No longer does the programmer have to deal with a “moving
target” of hardware and operating system software. Instead, Java’s “Code
once, run anywhere” motto promises that the code can be “future proof”
by making it compatible with future machines and operating systems.

Java as a Programming Language


One reason for Java’s success is that if you already know C or C++, Java is
easy to learn. By the same token, if you learn Java as your first language,
you will later be able to pick up C and C++ without much effort. Java is de-
scribed as an interpreted, object-oriented, strongly typed language that re-
lies heavily on support libraries. These characteristics of Java are
discussed in the following sections.

Java is object-oriented
An object is a program element that contains both data and code. The ratio-
nale for objects is that data is useful if there are operations that can be used
to transform it. For example, we find it useful to store numbers in a com-
puter system because there are operations that can be performed on these
numbers. A computer program stores the hourly wage of a company’s em-
ployees because it can later calculate the gross pay of each individual by
multiplying the hourly wage by the number of hours worked. What use
would it be to store numbers in a computer system that cannot perform
arithmetic?

Object-oriented programming (OOP) views a software system as a col-


lection of classes of objects. Each object class is a self-contained unit of
data and the processing operations that can be applied to this data. You
can image a payroll program that contains a class called Wa g e-
EarningEmployee. The objects of the class are the individual wage earn-
ers employed by the company. In this sense Joe Smith, who makes wages

© 2002 by CRC Press LLC

E:\Java for Engineers\VP Publication\Java for Engineers.vp


Thursday, April 25, 2002 9:27:38 AM
Color profile: Disabled
Composite Default screen

of $18.25 per hour as a carpenter, is an object of the class


WageEarningEmployee. The class contains data elements for storing the
name and address, hourly wage, number of hours worked, number of de-
pendents, and all other information necessary for managing the payroll. In
addition, the class WageEarningEmployee also contains programming
routines (called methods) for calculating wages, paying taxes, printing
checks, and performing other necessary data manipulations. Other
classes of the payroll software system may be called SalariedEmployee,
AdministrativeStaff, and Executives. Each class would hold the data and
processing elements necessary for each employee type.

Programmers note:
As an object-oriented language, Java resembles Smalltalk. Smalltalk
was developed at the Xerox Palo Alto Research Center (PARC) and
first released in 1980. Although Smalltalk has never been very popu-
lar, it is considered a model for object-oriented programming lan-
guages. Java supports inheritance, encapsulation, and polymorphis,
the cornerstones of object-oriented systems.

Java is strongly-typed
Java is described as a strongly-typed language. This means that all data
must belong to a specific type and that the data type cannot be changed
while the program is executing. For example, whole numbers belong to one
data type and fractional numbers to another one.

To understand the notion of a strongly-typed language you can imagine


a data type named int, that is intended for storing integer (whole) num-
bers, and another type named float, designed for storing fractional num-
bers. (It just happens that the int and float data types actually exist in
Java.) In this language, we could use the int type to store the number of
dependents of an employee since this value would always be a whole
number; while the employee’s hourly wage, which could be a fraction,
would be stored in a type float. Now suppose that an employee, for tax
purposes, wanted to claim a fractional number of dependents, say 2.5. If
the language is strongly-typed it would not be possible to store a frac-
tional number in a data element of int type. A weakly-typed language, on
the other hand, would allow storing a fractional number in an integer data
type. Java is defined as strongly-typed because each data element must be
consistent with the type of the data container that holds it. Strongly typed
languages are said to be more reliable.

© 2002 by CRC Press LLC

E:\Java for Engineers\VP Publication\Java for Engineers.vp


Thursday, April 25, 2002 9:27:38 AM
Color profile: Disabled
Composite Default screen

Java is similar to C++


The basic syntax of Java is identical to C++. However, the designers of Java
proposed to solve several problems that had plagued C++ and to eliminate
features that were considered non-essential. The most visible difference is
that Java is a pure object-oriented language. This means that Java programs
must always use OO structures, while in C++ object-orientation can be
turned off. The following are some important differences between Java and
C++. Do not worry if you cannot understand all the terminology at this time
since all of this is revisited later.
• In Java, the size of the data types is the same for all platforms. For example, a
Java int data type must be encoded as a 32-bit signed 2s complement repre-
sentation (more on this later) in every platform to which Java is ported. This
is not the case in other languages in which the size of the data types can
change from one system to another one. This feature of Java is necessary to
ensure portability.
• In contrast with C and C++, Java performs automatic garbage collection at
run time. It is the language, not the programmer, who takes care of reclaim-
ing storage that is no longer in use. This simplifies the coding and program
design.
• Java supports multithreading. A thread can be loosely defined as an individ-
ual program task. Multithreading allows an application to perform several
tasks simultaneously. By supporting thread synchronization and schedul-
ing, as well as the handling of deadlocks, Java makes it possible to develop
code that makes better use of system resources and enhances performance.
• Java allows the programmer to deal with error conditions by means of ex-
ceptions. This simplifies the code and reduces clutter by offloading the er-
ror processing operations.
• Java is a smaller and simpler language than C and C++. It is easier to learn
and use and is more reliable.
• Java is free. All of the Java compilers, runtime, and standard libraries are
provided by Sun Microsystems at no charge. The software can be down-
loaded from the Sun Web sites and there are no royalties to be paid for its
use. The programs that you build using Java software can be sold without
displaying acknowledgments, disclaimers, or other statements of accep-
tance or recognition.

Java uses libraries


The Java language is quite small. Much of the language’s functionality is
achieved through libraries. There are two types of Java libraries: the core
libraries that are part of the Java Development Kit (JDK), and the optional

© 2002 by CRC Press LLC

E:\Java for Engineers\VP Publication\Java for Engineers.vp


Thursday, April 25, 2002 9:27:38 AM
Color profile: Disabled
Composite Default screen

library additions. The core libraries must be present in every implementa-


tion of Java, while the optional libraries can be present or not. However, if a
feature in an optional library is supported in a particular implementation, it
must be fully supported in the standard way.

The complexity of the Java libraries can intimidate a beginning pro-


grammer. In the current version of the Java Development Kit (JDK), there
are 12 core libraries. Table 1-1 lists the core Java libraries.
Table 1-1
Core Java Libraries
NAME CLASSES DESCRIPTION

java.lang 93 Basic runtime support for the Java


language
java.applet 4 Applets support
Java.awt 298 Windowing and GUI support
javax.swing 500 Supplements java.awt and improves
GUI support
java.io 75 Supports input and output
java.util 77 Utility data structures
java.rmi 65 Remote method calls
java.sql 26 Supports Java Database
Connectivity
java.security 106 Supports secure data coding and
decoding
java.net 38 TCP/IP, UDP, IP, and other network
support
java.beans 43 Component software support to
promote rapid application
development by reuse of existing
code fragments
java.text 50 Support for localized text elements
such as dates, time, and currency
java.math 2 Support for the DECIMAL and
NUMERIC types in the SQL
database. Do not confuse with
java.lang.Math class
javax.accessibility 14 Supports large text sizes for the
visually impaired

Java is an interpreted language


A Java program is executed by an application called the Java interpreter
that must be installed in the host system. The Java interpreter is named
Java. The interpreter reads the code contained in a file produced by the
Java compiler, called Javac. This compiler, in turn, reads a source file writ-
ten in the Java programming language. The result of the compilation step is
a file usually called the Java byte code. The Java source file, which serves as

© 2002 by CRC Press LLC

E:\Java for Engineers\VP Publication\Java for Engineers.vp


Thursday, April 25, 2002 9:27:39 AM
Color profile: Disabled
Composite Default screen

input to the compiler, has the extension .java. The Java byte code file gener-
ated by the Javac compiler has the extension .class. It is the file with the
.class extension that is executed by the Java interpreter. In Chapter 3, you
will learn to create and run a program using the Java software development
tools.

Java Code
A program, in general terms, is a sequential set of instructions designed to
perform a specific task. In this sense, the set of instructions that must be
followed to start up a particular model of automobile could be described as
the start-up program for that vehicle. By the same token, a computer pro-
gram is a set of logical instructions that makes the computer perform a spe-
cific function.

For example, you may write a computer program to calculate the inter-
est that accrues when you invest a given amount of money, at a certain in-
terest rate for a specific period of time. Another program could be used to
tell a robot when it is time to recharge its batteries. A third one to help a
physician diagnose a childhood disease by examining the patient’s symp-
toms. In all of these cases the program consists of a set of instructions
that perform conditional tests, follow a predictable path, and reach a pre-
dictable result. A set of haphazard instructions that lead to no predictable
end is not considered a program.
Communicating with an alien intelligence
When we write a computer program we are communicating with an alien in-
telligence. A computer is a machine built of metal, silicon, and other com-
posite materials. It has no knowledge and no common sense. In a way, a
computer is no more than a tin can. If one-hundred years ago someone had
found you attempting to communicate and give orders to a tin can, you
would have probably been committed to a mental institution.

Our main difficulty is that the tin can never knows what you mean. A
human intelligence has accumulated considerable knowledge of the
world and of society at large. The set of instructions for a human to get
me a can of pop out of a vending machine can be rather simple:
“Joe, here is fifty cents, would you please get me a Pepsi?”

Joe, who has knowledge of the world, understands that he must walk
out of the room, open the necessary doors and walk up and down stairs,
reach the vending machine, wait in line if someone is using it, then place
the coins in the adequate slot, punch the Pepsi button, retrieve the can of
pop, and bring it back to me, again opening doors and walking up and
down stairs as necessary. Joe has knowledge of doors, of stairs, of money,

© 2002 by CRC Press LLC

E:\Java for Engineers\VP Publication\Java for Engineers.vp


Thursday, April 25, 2002 9:27:39 AM
Color profile: Disabled
Composite Default screen

of waiting in line, of vending machines, and of a thousand other worldly


things and social conventions that are necessary to perform this simple
chore.

The machine, on the other hand, has no previous knowledge, does not
understand social conventions, and has no experience with doors, stairs,
people standing in line, or vending machine operation. If we forget to tell
the robot to open the door it will crash through and leave a hole shaped
like its outline. If we forget to tell it to wait in line if someone else is using
the vending machine, then the robot may just walk over the current cus-
tomer in its effort to put the coins in the slot. The tin can has no experi-
ence, no social manners, and no common sense. Giving instructions to a
machine is different and much more complicated than giving instructions
to an intelligent being.

This is what computer programming is about. It is sometimes consid-


ered difficult to learn, not so much because it is complicated, but because
it is something to which we are not accustomed. Learning programming
requires learning the grammar and syntax of a programming language,
but, perhaps more importantly, it requires learning to communicate with
and issue commands to a tin can; a task indeed!

Flowcharting
Computer scientists have come up with tools and techniques to help us de-
velop programs. One of the simplest and most useful of these tools is the
flowchart. A flowchart, like the word implies, is a graphical representation
of the flow of a program. In other words, a flowchart is a graph of the tests,
options, and actions that a program must perform in order to achieve a spe-
cific logical task.

Incidentally...
Present-day computers do not have human-like intelligence. Assump-
tions that are obvious when dealing with human beings are usually in-
valid when dealing with a machine. Computer programs must leave no
loose ends and presume no reasonable behavior. You cannot tell a
computer “well... you know what I mean!” or assume that a certain op-
eration is so obvious that it need not be explicitly stated. The program-
mer uses a flowchart to ensure that each processing step is clearly
defined and that the operations are performed in the required se-
quence.

© 2002 by CRC Press LLC

E:\Java for Engineers\VP Publication\Java for Engineers.vp


Thursday, April 25, 2002 9:27:39 AM
Another Random Document on
Scribd Without Any Related Topics
Nevis, Ben, ascent and scenery of, 149.

New Guinea, 332.

New Ireland, character of inhabitants of, 331.

Ney, Marshal, Napoleon's statement regarding the last acts of, 187.

Nicolas' History of the Navy, review of, 82.

November Morning's Reverie, a, by Delta, 618.

Oil Painting, Eastlake's History of, reviewed, 301.

O'Meara, connexion of, with Napoleon, 180.

Only a Fiddler, Andersen's, reviewed, 403.

O. T., Andersen's, reviewed, 405.

Our Currency, our Trade, and our Tariff, 744.

Pacific, Islands of the, 327.

Pæans of the Athenian Navy, No. I.;


Phormio's Victory in the Corinthian Gulf, 736.

Park, Mungo, 515.

Pau, Sketches of, 719.

Pauperism, management of, 630.

Peel, Sir Robert, and the Currency, 113, 744.

Peru, Sketches of conquest of, 1.

Phormio, Naval Victory of, in the Corinthian Gulf, 736.

Pizarro, Conqueror of Peru, Sketches of, 1.

Pizarro, Pedro, brother of the conqueror, 3.

Poe's Sketches and Tales, review of, 582.


Poetry—Cæsar, 235;
a Requiem, by Delta, 358;
Song for the Dalhousie Dinner, 493;
Magus Muir, 614;
a November Morning's Reverie, 618;
the Widow of Glencoe, 700;
Pæans of the Athenian Navy, No. 1, 741.

Pomfret, Lady, 441.

Popular Superstitions, Letters on the Truths contained in, Letter VII.;


objects to be gained by the Artificial Induction of Trance, 166.

Portrait, the, a tale abridged from the Russian of Gogol, by T. B. Shaw;


Chap. I. 457
Chap. II. 475.

Premier Pas, Le, 312.

Prescott's History of the Conquest of Peru, review of, 1.

Protestantism, Effects of, in England, 724.

Puna, Conquest of island of, by Pizarro, 11.

Pyrenees, the, 707.

Raffles, Sir Stamford, 526.

Railway, Probable Effects of, on India, 517.

Railway Witness, Letters from a, in London, 68.

Railways, the, in connexion with the financial depression, 777.

Reformation, Effects of the, in England, 724.

Reid and the Philosophy of Common Sense, 239.

Requiem, for the music of Mozart, by Delta, 358.

Research and Adventure in Australia, 602.

Richard Cœur de Lion, fleet of, 90, 91.


Richter, Jean Paul, Life of, 33.

Roman Dogs, 489.

Rome, Hounds and Horses at: the English Kennel, 485


the Steeple Chase, 487
Roman Dogs, 489.

Rome, Taxidermy in, 292.

Rome, Valedictory Visits at, 622


the Villa Borghese, ib.
the Villa Albani, 626.

Roussillon, province of, 722.

Rubens—was he a Colourist? 564.

Ruiz, Bartholomew, one of Pizarro's comrades, 6.

St Helena, Napoleon at, 178.

Sea, Evenings at—See Evenings.

Sharp, Archbishop, murder of, 615.

Shaw, T. B., translation by, of the Portrait, a tale;


Chap. I. 457
Chap. II. 475.

Sieyes, Anecdotes of, 190, 191.

Sims' Wigwam, &c., review of, 575.

Sinnett's Byways of History, review of, 347.

Sir Robert Peel and the Currency, 113.

Smuggling in Spain, 717.

Solon, era of, in Greece, 143.

Song for the Dalhousie Dinner, 493.


Solo, Hernando de, 12.

Sourabaya, city of, 525.

South America, Adventures on coast of, 323.

South America, Spanish conquest in, 1.

Spain, conquests of, in South America, 1.

Spain, sketches of, 707.

Spain, History of the Jew in, 730.

Speedy, capture of the Gamo by the, 84.

Stair, Master of, and the Massacre of Glencoe, 700-1.

Steeple chase at Rome, the, 487.

Stone of Shelter, the, 158, 160.

Story of my Life, Andersen's, review of, 393.

Student of Bologna, the; Chap. I. 359


Chap. II. 361
Chap. III. 365
Conclusion, 369.

Suffolk, Lady, 439, 440.

Sumatra, island of, 528.

Tacamez, defeat of Pizarro at, 7.

Tale of the Masorcha Club at Buenos Ayres, a;


Chap. I. 47
Chap. II. 48
Chap. III. 50
Chap. IV. 55
Chap. V. 62.

Tariff, the new, in connexion with the commercial depression, 759.

Tales from Denmark, Andersen's, reviewed, 406.


Taxidermy in Rome, 292.

Tettenborn, General, rise of, 312.

Theophilus, work on Varnishes, &c., by, 303.

Thirlwall's Greece, character of, 129


on the siege of Troy, Homer, &c., 137, 138.

Thompson's Memoirs of Viscountess Sundon, review of, 431.

Three Months at Gaza, 334.

Tiberius, 411.

Times of George II., the, 431.

Torres Straits, surveying voyage through, 518.

Tournachou, M., tale from, 317.

Trance, objects to be gained by artificial induction of, 166.

Travels, modern, general character of, 707.

Troy, authenticity of the siege of, 136, 137.

Turkey, Napoleon's views on, 189.

Unpublished French novel, an, 671.

Units: Tens: Hundreds: Thousands:


Chap. I. 593
Chap. II. ib.
Chap. III. 595
Chap. IV. 596
Chap. V. 599
Chap. VI. 601.

Vaerst, Baron, Die Pyrenaën, review of, 707.

Valbezene, M., 102.


Valedictory Visits at Rome, 622
the Villa Borghese, ib.
the Villa Albani, 626.

Van Eyck, Eastlake on the invention of, 302.

Views and Reviews of American Literature, review of, 575.

Villa Borghese, the, 622; Albani, 626.

Vision of Cagliostro, the, 408;


Tiberius, 411;
Agrippa, 413;
Milton, 415;
Mirabeau, 417;
Beethoven, 419.

Voltaire, residence of, in England, 444.

W. E. A., Magus Muir, by, 614;


Widow of Glencoe, 700.

Waleska, Madame, anecdote of, 191.

Widow of Glencoe, the, 700.

William the Conqueror, landing of, 90.

William III. and the Massacre of Glencoe, 700.

Wolfian theory of the Iliad, the, 140.

Works of Hans Christian Andersen, the, 387.

Wreck, law of, 93.


END OF VOL. LXII.

Printed by William Blackwood & Sons, Edinburgh.


FOOTNOTES:
[1] Essays. By Ralph Waldo Emerson. Nature, an Essay, and
Orations. By the same.
[2] Memoirs of Sir Ewen Cameron of Lochiel.
[3] Die Pyrenäen. Von Eugen Baron Vaerst. Zwei Bände: Breslau,
1847.
[4] Marliani, Histoire Politique de l'Espagne Moderne, ii. 440.
[5] El santo zancarron, (literally, the holy dry bone,) an expression
handed down from the Moors, and very dangerous to be used for
some time after their expulsion, when an oath "by Mahomet"
sufficed to make the utterer suspected by the Inquisition of
addiction to the forbidden faith. It was to escape all suspicion of
such addiction that the Spaniards became great consumers of
pig's flesh, still a standard dish, in one form or other, at every
Spanish dinner. Probably it was the excellent quality of Spanish
pork, as much as the fear of the Inquisition, that perpetuated this
custom.
[6] "I would much rather be a keeper of lions than have charge of
Biscayans."
[7] Marliani, ii. 317.
[8] See Thucyd. i. 143, and Xenoph. de Repub. Ath. i. 19.
[9] See the remarkable passage in Herodotus (Terpsichore, 78)
where he describes the change in the spirit of the Athenians after
they had got rid of the yoke of the Pisistratidæ, and felt the full
vigour of the free institutions which Cleisthenes had perfected for
them.
[10] Scott's Life of Napoleon.
[11] History of Greece, vol. iii. p. 26, n.
[12] Plutarch in Vitâ Lysandri.
[13] Plutarch in Vitâ.
[14] Herodotus Polyhymnia, 144.
[15] See the speech of Pericles at the end of the first book of
Thucydides, and also the great speech in the second book.
[16] Thucyd., iv. 10.
[17] Speech of Phormio to his crews before the second battle in
the Gulf.—Thucyd. ii. 89.
[18] Herod., Urania, 90.
[19] The Paralus was the name of one of the two sacred galleys,
which the Athenians employed for the conveyance of despatches,
and state missions; and which were always equipped and manned
with the greatest care. It is not specified in Thucydides that the
Paralus was one of Phormio's galleys; but from the brilliant
exploits of his squadron in this and a subsequent battle, we may
fairly suppose it to have been composed of the Elite of the
Athenian navy.

Transcriber's note:
Archaic spelling and variations in
spelling and hyphenation have been
retained except in obvious cases of
typographical error.
Anchors to footnotes 1 and 2 have
been supplied by the transcriber.
Table of contents has been created
for the HTML version.
*** END OF THE PROJECT GUTENBERG EBOOK BLACKWOOD'S
EDINBURGH MAGAZINE—VOLUME 62, NO. 386, DECEMBER, 1847
***

Updated editions will replace the previous one—the old editions


will be renamed.

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


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

START: FULL LICENSE


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

To protect the Project Gutenberg™ mission of promoting the


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

Section 1. General Terms of Use and


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

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


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

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

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


Gutenberg:

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


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

This eBook is for the use of anyone anywhere in the United


States and most other parts of the world at no cost and
with almost no restrictions whatsoever. You may copy it,
give it away or re-use it under the terms of the Project
Gutenberg License included with this eBook or online at
www.gutenberg.org. If you are not located in the United
States, you will have to check the laws of the country
where you are located before using this eBook.

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


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

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


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

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


Gutenberg™ License terms from this work, or any files
containing a part of this work or any other work associated with
Project Gutenberg™.

1.E.5. Do not copy, display, perform, distribute or redistribute


this electronic work, or any part of this electronic work, without
prominently displaying the sentence set forth in paragraph 1.E.1
with active links or immediate access to the full terms of the
Project Gutenberg™ License.

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

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


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

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


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

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

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


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

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


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

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

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


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

1.F.

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


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

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


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

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


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

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


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

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


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

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


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

Section 2. Information about the Mission


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

Volunteers and financial support to provide volunteers with the


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

Section 3. Information about the Project


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

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


West, Salt Lake City, UT 84116, (801) 596-1887. Email contact
links and up to date contact information can be found at the
Foundation’s website and official page at
www.gutenberg.org/contact
Section 4. Information about Donations to
the Project Gutenberg Literary Archive
Foundation
Project Gutenberg™ depends upon and cannot survive without
widespread public support and donations to carry out its mission
of increasing the number of public domain and licensed works
that can be freely distributed in machine-readable form
accessible by the widest array of equipment including outdated
equipment. Many small donations ($1 to $5,000) are particularly
important to maintaining tax exempt status with the IRS.

The Foundation is committed to complying with the laws


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

While we cannot and do not solicit contributions from states


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

International donations are gratefully accepted, but we cannot


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

Please check the Project Gutenberg web pages for current


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

Section 5. General Information About


Project Gutenberg™ electronic works
Professor Michael S. Hart was the originator of the Project
Gutenberg™ concept of a library of electronic works that could
be freely shared with anyone. For forty years, he produced and
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.
Welcome to our website – the ideal destination for book lovers and
knowledge seekers. With a mission to inspire endlessly, we offer a
vast collection of books, ranging from classic literary works to
specialized publications, self-development books, and children's
literature. Each book is a new journey of discovery, expanding
knowledge and enriching the soul of the reade

Our website is not just a platform for buying books, but a bridge
connecting readers to the timeless values of culture and wisdom. With
an elegant, user-friendly interface and an intelligent search system,
we are committed to providing a quick and convenient shopping
experience. Additionally, our special promotions and home delivery
services ensure that you save time and fully enjoy the joy of reading.

Let us accompany you on the journey of exploring knowledge and


personal growth!

ebookname.com

You might also like