Home page of Holt Software Associates  | Home page of the Turing Programming Language, the fastest way to teach programming concepts  | Home page of Holt Software's Java products  | Home page of Ready to Program with Java(tm) Technology, a Java development environment designed for education  | Information about Holt Software's courses for teachers  | Information about how to contact Holt Software  | Information about how students can purchase Holt Software's books and software  | Information about how schools and bookstores can purchase Holt Software's books and software

Holt Software Books    [Graphical Version]  |  [Printer Friendly Version]

[Cover of Book]

Programming Concepts in Java
(Web Edition)


Book Information

Title: Programming Concepts in Java (First Edition)
Authors: J.N.Patterson Hume and Christine Stephenson
ISBN: 0-921598-30-0
Publisher: Holt Software Associates Inc.
Binding: Softcover
Pages: 532 pgs
Price: Bookstores & Schools: $39.95    Retail: $49.95
Ordering Information: For bookstores and schools, click here for ordering information.
For individuals click here for ordering information.
Program Examples: Found on diskette included with book
Solutions Manual: Available [Click here for information on obtaining Solutions Manuals for Holt Software publications.]

Book Description

Designed for a first course in computer science in colleges and universities, Programming Concepts in Java emphasizes the basic concepts, principles and paradigms of computer science while using the Java language.

By using classes provided with the textbook to simplify textual input and output, Programming Concepts in Java teaches the fundamentals of computer science without becoming mired in Java's complexities.

In doing so, it covers concepts such as input of data, control constructs, methods, classes and inheritance, strings, applets, arrays, records, algorithms for sorting, linked lists, and trees.

Recognizing that Java's popularity with students rests with its ability to produce graphics applications and applets as well as its association with the World Wide Web, Programming Concepts in Java also has chapters covering HTML, the creation of applets and GUI applications, as well as a chapter covering the details of the classes used earlier in the book.

Programming Concepts in Java comes with a disk containing a suite of tools and classes (Console, PrintFiles, PrettyPrint and others) as well as all of the example classes contained in the book.


Preface to Programming Concepts in Java (First Edition)

This textbook, Programming Concepts in Java, is intended to be used in a first course in computer science. It emphasizes the basic concepts of programming and the object-oriented programming paradigm. The programming language used in this book is Java. No previous knowledge of programming is needed, although some contact with computers and operating environments, such as Microsoft Windows 95 or NT, would be an asset.

Programming Concepts in Java focuses on computing concepts with the ultimate goal of facilitating the broadest possible coverage of the core computer science curriculum. In an effort to provide material for courses covering the World Wide Web we have included an introductory chapter on creating web pages using HTML.

To begin, Java standalone application programs are used exclusively. Applets are covered in considerable detail in later chapters. Some of the more advanced notions of concurrency, exception handling, and graphical user interfaces have been omitted or are discussed in an abbreviated way.

This textbook package includes a disk containing a collection of Java classes to facilitate the teaching of Java. These include the Console class which enables students to do text and graphics I/O without having to master the intricacies of the Java Abstract Windowing Toolkit. In the last chapter of the book this Console class is presented in detail to show how such a large class is constructed using classes from the standard Java class library. The collection includes the Stdin class, which allows students to read all of Java's primitive data types from the standard input stream without having to master Java data type conversion. There are also classes for pretty printing (paragraphing) Java programs, reading Java primitive data types from text files, and submitting programs for marking. A complete set of the classes presented as examples in this book is also on the disk.

(Additional references should be consulted if a complete syntax of Java or the Java class libraries is required.)

Overview

This book covers the material in standard curricula for first courses in computer science. As well, it emphasizes the object-oriented paradigm.

The list of chapter titles outlines the arrangement of materials.

  1. Programming Paradigms
  2. Basic Programming Language Concepts
  3. Input of Data
  4. Control Constructs
  5. Strings
  6. Methods
  7. Classes and Inheritance
  8. Applets and Graphical User Interfaces
  9. Creating Web Pages with HTML
  10. Arrays
  11. Records in Java
  12. Algorithms for Sorting Lists
  13. Self-Referential Classes and Linked Lists
  14. Trees
  15. Advanced GUIs
  16. The Console Class
Chapter 1 introduces the difference between the two major programming paradigms: the procedure-oriented paradigm and the object-oriented paradigm which is the paradigm of the Java programming language. Abstraction is introduced as a way of making programs easier to create and to understand. A number of the basic elements of the Java syntax are introduced, particularly the idea of a class and a method. These are illustrated by graphic examples using the Console class. The details of all these concepts are explored in later chapters. Instructions are provided for the creation and running of Java standalone applications.

Chapter 2 presents the EBNF metalanguage for formally describing the syntax of a programming language. The primitive data types of the Java language are defined along with the way to declare variables of these types. Expressions for each type are also defined and the assignment statement presented. The chapter explains how values of the different types are output and formatted using the Console class. The role of comments in providing internal documentation to a program is also discussed.

Chapter 3 discusses how data can be input to a program. Ways in which a list of data items can be input by counted or conditional loops are shown. Input from the standard input, the keyboard, and input from a file are discussed. Ways to generate data using random numbers for purposes of testing programs are presented. The statistical analysis of numerical data is also described.

Chapter 4 deals with program structure. Algorithms can be programmed using three basic forms of control structure: linear sequence, repetition, and selection. The Java syntax for each of these is defined. The use of diagrams such as flow charts to supplement the program itself is discussed and shown to be unnecessary for a structured program which is properly paragraphed, and internally documented. Tracing execution of a program before trying to run it on a computer is encouraged

Chapter 5 introduces the String data structure which is implemented using the String class. Strings in Java are objects instantiated from the String class. Methods of the class are shown. The StringBuffer class is introduced as useful when the contents of a string are to be changed. The StringTokenizer class which permits the breaking of a string into tokens is illustrated.

Chapter 6 provides details about methods - components of a object that can be used by other objects to operate on the data of the original object. As with subprograms of earlier programming languages, methods fall into two principal classes: procedure-type methods that perform some action and function-type methods that yield a value. The differences in the way these two types of methods are defined and invoked is detailed. The relation between formal and actual parameters is explained. The scope of identifiers in a program is outlined. The signature, header, and specifications of a method are defined. Methods that call themselves (recursive methods) - and iterative methods that accomplish the same result - are dealt with.

Chapter 7 shows how an object can encapsulate data and the methods that operate on the data, and illustrates how other objects that use that object are prevented from interfering with the encapsulated data. The class is the template from which an object is instantiated. A constructor method of the class is used to create a new instance of the class - the object. Examples are given of using and creating a class. Inheritance is introduced as a means by which new classes are created through modifications of a base class. By using the Java library of classes, multiple objects of the class can be created or new classes produced.

Chapter 8 introduces Java applets. Applets are invoked by using a browser, such as Netscape Navigator, and can be accessed through the World Wide Web. It is this feature of Java that is at the root of much of its popularity, as well as its being an object-oriented programming language. Graphical User Interfaces (GUIs) are introduced. This chapter covers many of the classes in Java's Abstract Windowing Toolkit (awt).

Chapter 9 explores the creation of web pages using HTML (Hypertext Markup Language). The use of HTML to format information, create tables, place pictures, and display lists is discussed in some detail. The chapter also discusses the details controlling the presentation of an applet: its size, location on the screen, and so on.

Chapter 10 introduces the structured data type called an array. Individual elements of an array share the same name and data type but are distinguished from each other by having an index. An individual element of an array can be passed by value to a method whereas an entire array is passed, as any object is, by reference. When the method alters its array parameter the actual array is altered. The efficiencies of searching an array by a linear search and a sorted array by a binary search are compared.

Chapter 11 describes implementing records as objects and the reading from and writing to binary files. In Java, there is no standard way to store an object's fields in a record. As a result, it must be programmed The ways records can be input from or output to a file are shown, as is the storage of records in a binary form so that random access to individual records is possible. A simple linear search of an array of records is introduced as an example of using records.

Chapter 12 presents algorithms for sorting lists of data stored in arrays. The time complexity of sorting algorithms is explored and big O notation introduced. The chapter also explains how methods depending on recursion prove to be more efficient than simple exchange algorithms.

Chapter 13 gives details of self-referential classes and how they can be used to instantiate nodes to link objects together in simple linked lists. A List class is created and then modified to produce an OrderedList class by inheritance.

Chapter 14 introduces the binary tree as a data structure that has a recursive definition and is easily implemented by having two links in a node. The chapter demonstrates how the efficiency of searching achieved with a sorted array using a binary search, and the ease of insertion and deletion of elements in a linear linked list is possible with a binary search tree. The heap sort is introduced as a recursive method of sorting which uses trees defined somewhat differently than binary search trees.

Chapter 15 introduces many of the more advanced features of the graphical interface capabilities of Java's Abstract Windowing Toolkit (awt) by guiding students through the construction of a movie ticket seller applet and a simple paint applet.

Chapter 16 provides a detailed example of building a graphical user interface. It examines a simplified version of the HSA Console class to further explore Java's Abstract Windowing Toolkit.

Conventions

This book uses a number of naming conventions for identifiers. These are not part of the Java language but are used to make programs understandable.

Flexibility

Programming Concepts in Java has been organized to provide an introduction to the fundamental concepts of computer science. The object-oriented paradigm of the Java programming language is used to illustrate basic principles.

Differing course demands and student populations may require instructors to omit certain chapters or parts of chapters, or to insert additional material to cover some concepts in greater detail. For example, the discussion of algorithm complexity and big O notation can easily be omitted from the course of study. The instructor may wish to provide other resources if more than an introduction to program correctness or the use of Java on the Internet is desired.

The Java Programming Language

Java is a programming language that was developed at Sun Microsystems. Java standalone application programs provide all the features of other general purpose languages such as Pascal or C. Java applets add the flexibility of sharing programs via the World Wide Web and Internet. Java is an object-oriented programming language and has been provided with an extensive library of classes that can be used in creating programs. This library is being rapidly extended by its many users.

The language is portable; it can be used on any computer platform that has a Java interpreter. This means that software developers can confidently program in Java and know that their software will run on any such computer. As well, individuals can also share applets via the Web. Attempts are made to make the use of shared programs safe. For security, for example, no applet may read from or write to a file on the system on which it is being executed.

Java syntax is based on the C syntax but many of the difficult and error prone parts of C and C++, such as pointers, operator overloading, and multiple inheritance have been eliminated. In this book we have eliminated still more of the "tricks" that some C programmers delight in. Our approach is based on the fundamental principle of structured programming, namely keeping programs easy to understand.

Java and its class libraries have many additional features which are not part of C or C++. It provides for strings, graphics, concurrency, and exception handling, as well as a large number of data structures in its class libraries. Java also provides graphical user interface classes.

All of these features contribute to Java's attractiveness as both a commercial software tool and a means of addressing the core computer science concepts.


Table of Contents of Programming Concepts in Java

  • PREFACE
  • ACKNOWLEDGMENTS
  • Chapter 1 - PROGRAMMING PARADIGMS
  • 1.1 What is Java?
  • 1.2 What is Programming?
  • 1.3 Abstraction in Programs
  • Procedural Abstraction
  • Data Abstraction
  • 1.4 Programming Paradigms
  • Procedure-Oriented Programming
  • Object-Oriented Programming
  • 1.5 Key Concepts in Object-Oriented Programming
  • Objects
  • Classes
  • Inheritance
  • 1.6 Programming in Java
  • Locating a Figure in the Console Window
  • Drawing a Colored Rectangle in the Console Window
  • 1.7 Standalone Programs in Java
  • 1.8 User-Defined Methods
  • Simple Examples of User-Defined Methods
  • A More Complicated Example
  • 1.9 The Form of Application Programs
  • 1.10 Running a Java Application Program
  • 1.11 Using the Boiler Plate Class
  • 1.12 Chapter Summary
  • Steps in Programming
  • Procedural Abstraction
  • Data Abstraction
  • Object-Oriented Programming
  • Objects, Classes, and Inheritance
  • Graphics Procedures
  • User-Defined Methods
  • Structure Charts
  • Other Java Syntax
  • The Form of Application Programs
  • Running an Application Program
  • 1.13 Exercises
  • Chapter 2 - BASIC PROGRAMMING LANGUAGE CONCEPTS
  • 2.1 Metalanguage for Defining Syntax
  • 2.2 Primitive Data Types
  • 2.3 Declarations of Variables
  • 2.4 Expressions: Arithmetic and Boolean
  • Arithmetic Expressions
  • Boolean Expressions
  • 2.5 Assignment Statements
  • Initializing Variables in their Declarations
  • Constants
  • Syntax of Assignment Statements
  • Variable Names on Both Sides of an Assignment Statement
  • 2.6 Output Statements
  • Output Formatting
  • 2.7 Comments in Programs
  • 2.8 Chapter Summary
  • Metalanguage for Syntax Definition
  • Primitive Data Types and Declarations
  • Arithmetic Expressions
  • Boolean Expressions
  • Assignment Statements
  • Output Statements
  • Comments
  • 2.9 Exercises
  • Chapter 3 - INPUT OF DATA
  • 3.1 Entering Programs
  • 3.2 Standard Input and Output
  • 3.3 Input of Numerical Data
  • 3.4 Input of String Data
  • 3.5 Input of Sequences of Data
  • Counted Repetition
  • Conditional Repetition
  • 3.6 Input from a File
  • 3.7 Output to a File
  • 3.8 Generated Data
  • 3.9 Statistical Analysis of Data
  • 3.10 Chapter Summary
  • Entering Programs
  • Input of Data
  • Input of Sequences of Data
  • Input from a File
  • Output to a File
  • Generated Data
  • Statistical Analysis of Data
  • 3.11 Exercises
  • Chapter 4 - CONTROL CONSTRUCTS
  • 4.1 Structure within Methods
  • 4.2 Repetition Constructs
  • The Counted Loop
  • Testing of Loops
  • Proving Loop Correctness
  • 4.3 Basic Selection Constructs
  • 4.4 Flow Charts
  • 4.5 Tracing Execution
  • 4.6 Another Selection Construct
  • 4.7 Checking Input Data
  • 4.8 Common Programming Errors
  • 4.9 Chapter Summary
  • Control Constructs
  • Flow Charts
  • Repetition Constructs
  • Selection Constructs
  • Tracing Execution
  • The Switch Construct
  • Checking Bad Data
  • 4.10 Exercises
  • Chapter 5 - STRINGS
  • 5.1 The String Data Type
  • 5.2 Declaring String Objects
  • 5.3 Concatenation of Strings
  • 5.4 Replacing Characters in Strings
  • 5.5 Searching for Patterns in Strings
  • 5.6 Comparing Strings
  • 5.7 The StringBuffer Class
  • 5.8 The StringTokenizer Class
  • 5.9 Text Processing
  • 5.10 Chapter Summary
  • The String Data Type
  • String Methods
  • Searching for Patterns in String Objects
  • Comparing Strings
  • The StringBuffer Class
  • The StringTokenizer Class
  • 5.11 Exercises
  • Chapter 6 - METHODS
  • 6.1 Kinds of Methods
  • 6.2 Calling a Method in a Program
  • 6.3 Defining a Method
  • Labelling Methods and Variables as Static
  • 6.4 Access to Instance Variables
  • 6.5 Scope of Identifiers
  • 6.6 Testing of Programs
  • 6.7 Tracing of Methods
  • 6.8 Function Methods
  • 6.9 Method Overloading
  • 6.10 Recursive Methods
  • 6.11 An Example Using Methods
  • 6.12 Function Methods with Side Effects
  • 6.13 Chapter Summary
  • Types of Methods
  • Defining Methods
  • Local Identifiers, Global Identifiers, and Parameters
  • Testing of Programs
  • Tracing of Programs
  • Recursive Methods
  • 6.14 Exercises
  • Chapter 7 - CLASSES AND INHERITANCE
  • 7.1 Objects and Abstract Data Types
  • 7.2 Using a Class
  • 7.3 Creating the Turtle Class
  • 7.4 Instantiating Two Objects from a Class
  • 7.5 Method Overloading
  • 7.6 Creating a New Class by Inheritance
  • Using the Modified Class
  • 7.7 Class Hierarchy
  • 7.8 Chapter Summary
  • Abstract Data Types
  • Using an Object
  • The Turtle Object
  • Classes
  • Creating a New Class by Inheritance
  • 7.9 Exercises
  • Chapter 8 - APPLETS AND GRAPHICAL USER INTERFACES
  • 8.1 The Structure of an Applet
  • 8.2 Applets with no Input or GUI
  • 8.3 Applets with User Input and Output with GUI
  • 8.4 Applets with Multiple GUI Components
  • 8.5 Layout of GUI Components
  • 8.6 Other GUI Components
  • 8.7 Graphics Using Applets
  • 8.8 Simple Animation
  • 8.9 An Example Using GUIs and Graphics
  • 8.10 Chapter Summary
  • Applets
  • Applets with Input and Output and GUI
  • Applets with Multiple GUIs
  • Layout of GUI Components
  • Other GUI Components
  • Graphics Using Applets
  • Simple Animation
  • Complex Graphical User Interfaces
  • 8.11 Exercises
  • Chapter 9 - CREATING WEB PAGES WITH HTML
  • 9.1 The Hypertext Markup Language
  • 9.2 Markup Tags
  • 9.3 HTML Documents
  • 9.4 HTML Tags for Formatting Text
  • 9.5 Linked Web Pages
  • 9.6 Tables in Web Pages
  • 9.7 Images in Web Pages
  • 9.8 Applets in Web Pages
  • 9.9 An Example Web Page with Applets
  • 9.10 Chapter Summary
  • Hypertext Markup Language (HTML)
  • Markup Tags
  • HTML Documents
  • Formatting Text
  • Tag Attributes
  • Linking Web Pages
  • Tables in Web Pages
  • Images in Web Pages
  • Applets in Web Pages
  • Web Page
  • 9.11 Exercises
  • Chapter 10 - ARRAYS
  • 10.1 Lists as Arrays
  • Frequency Distribution
  • A Class for Maintaining a List of Names
  • Computing Prime Numbers
  • 10.2 Related Lists
  • 10.3 Declaration of Arrays
  • 10.4 Two-Dimensional Arrays
  • 10.5 Methods With Array Parameters
  • 10.6 Searching
  • 10.7 Efficiency of Algorithms
  • Running Time for Sequential Search
  • Running Time for Binary Search
  • Big O Notation
  • Concentrating on Loops and Recursion
  • 10.8 Chapter Summary
  • Lists as Arrays
  • Related Lists
  • Declaration of Arrays
  • Tables as Arrays
  • Methods With Array Parameters
  • Searching
  • Efficiency of Algorithms
  • 10.9 Exercises
  • Chapter 11 - RECORDS IN JAVA
  • 11.1 Records
  • 11.2 Arrays of Records
  • Two-Dimensional Arrays of Records
  • 11.3 Storing Records in Binary Files
  • 11.4 Example of Using a Binary File
  • 11.5 Records with Alternative Sets of Fields
  • 11.6 Chapter Summary
  • Records as Objects
  • Array of Records
  • Example of Using Records
  • Storing Records in Binary Files
  • Searching a Random Access File
  • Records with Alternative Sets of Fields
  • 11.7 Exercises
  • Chapter 12 - ALGORITHMS FOR SORTING LISTS
  • 12.1 What is Sorting?
  • 12.2 Insertion Sort
  • 12.3 Selection Sort
  • 12.4 Bubble Sort
  • Top Down Design of Bubble Sort
  • Improving Bubble Sort
  • 12.5 Running Time for Sorting Algorithms
  • Running Time for Bubble Sort
  • Running Time of Insert and Selection Sort
  • 12.6 Merge Sort
  • The Nature of Recursion
  • 12.7 Quicksort
  • 12.8 Chapter Summary
  • Insertion Sort
  • Selection Sort
  • Bubble Sort
  • Recursive Sorts
  • Merge Sort
  • Quicksort
  • Timing of Recursive Sorts
  • 12.9 Exercises
  • Chapter 13 - SELF-REFERENTIAL CLASSES AND LINKED LISTS
  • 13.1 Links
  • 13.2 Singly Linked Lists
  • 13.3 A List Class
  • Sample Execution of Demonstration Program
  • 13.4 Implementation of List Class
  • 13.5 Ordered Lists
  • Sample Execution of Demonstration Program
  • 13.6 Chapter Summary
  • Links
  • List Class
  • Linked List Implementation of List Class
  • Ordered Lists
  • 13.7 Exercises
  • Chapter 14 - TREES
  • 14.1 Binary Search Trees
  • 14.2 An Implementation of the Ordered List Using a Tree
  • 14.3 Deleting a Node from a Tree
  • 14.4 Using a Binary Tree to Sort: Heap Sort
  • 14.5 Chapter Summary
  • Binary Search Trees
  • Sorting Using a Binary Search Tree
  • Heaps
  • Implementing a Heap Using an Array
  • Sorting Using a Heap
  • 14.6 Exercises
  • Chapter 15 - ADVANCED GUIS
  • 15.1 The MovieWicket Example Problem
  • 15.2 Layout of GUIs
  • 15.3 Layout for the MovieWicket Applet
  • 15.4 Implementation of the Actions of Applet
  • 15.5 Drawing Using the Mouse
  • 15.6 GUIs with Java Applications
  • 15.7 Menus
  • 15.8 The PaintShape Example Problem
  • 15.9 Chapter Summary
  • Design of a Graphical User Interface
  • Layout of Interface
  • FlowLayout Manager
  • BorderLayout Manager
  • GridLayout Manager
  • Implementation of the Actions of the Applet
  • Interacting with the Mouse
  • Graphical User Interfaces in Applications
  • 15.10 Exercises
  • Chapter 16 - ADVANCED GUIS: THE CONSOLE CLASS
  • 16.1 The Console Class
  • 16.2 The BaseConsole Class
  • 16.3 Methods of BaseConsole for Graphics
  • 16.4 Methods of BaseConsole for Basic Text Input
  • 16.5 Methods of BaseConsole Class for Output
  • 16.6 Methods of BaseConsole for Input
  • 16.7 The BaseConsoleCanvas Class
  • 16.8 Chapter Summary
  • The BaseConsole Class
  • Text Handling
  • Windows
  • 16.9 Exercises
  • APPENDICES
  • Appendix A : Reserved Words
  • Appendix B : Java Class Library
  • Classes Sorted by Package
  • Descriptions
  • Appendix C : HSA Class Library
  • Appendix D : Operators
  • Mathematical Operators
  • Boolean Operators
  • Bit Manipulation Operators
  • Operator Precedence
  • Appendix E : Applet Syntax
  • Appendix F : Application Syntax
  • Appendix G : Installing the hsa Package and the Book Examples
  • Appendix H : License Agreement for hsa Package
  • Appendix I : Web Resources for Java
  • INDEX

  • [ Holt Software Home ] * [ Books (Graphical) ] * [ Books (Text) ] * [ Top of Page ] * [ Feedback ]