Java Illuminated: An Active Learning Approach, 6th Edition

This document was uploaded by one of our users. The uploader already confirmed that they had the permission to publish it. If you are author/publisher or own the copyright of this documents, please report to us by using this DMCA report form.

Simply click on the Download Book button.

Yes, Book downloads on Ebookily are 100% Free.

Sometimes the book is free on Amazon As well, so go ahead and hit "Search on Amazon"

Written for the one- to three-term introductory programming course, the sixth edition of Java Illuminated provides learners with an interactive, user-friendly approach to learning the Java programming language. Comprehensive but accessible, the text takes a progressive approach to object-oriented programming, allowing students to build on established skills to develop new and increasingly complex classes. Java Illuminated follows an activity-based active learning approach that ensures student engagement and interest. In addition, the text presents other topics of interest, including graphical user interfaces (GUI), data structures, file input and output, and graphical applications.

Author(s): Julie Anderson; Hervé Franceschi
Edition: 6
Publisher: Jones & Bartlett Learning
Year: 2022

Language: English
Pages: 1288

Preface

Acknowledgments

Chapter 1 Introduction to Programming and the Java Language

Introduction

1.1 Basic Computer Concepts

1.1.1 Hardware

1.1.2 Operating Systems

1.1.3 Application Software

1.1.4 Computer Networks and the Internet

Computer Networks

The Internet

1.2 Practice Activity: Displaying System Configuration

1.2.1 Displaying Windows Configuration Information

1.2.2 Displaying Mac OS Configuration Information

1.3 Data Representation

1.3.1 Binary Numbers

1.3.2 Using Hexadecimal Numbers to Represent Binary Numbers

1.3.3 Representing Characters with the Unicode Character Set

1.4 Programming Languages

1.4.1 High- and Low-Level Languages

1.4.2 An Introduction to Object-Oriented Programming

1.4.3 The Java Language

1.5 An Introduction to Programming

1.5.1 Programming Basics

1.5.2 Program Design with Pseudocode

1.5.3 Developing a Java Application

1.5.4 Programming Activity 1: Writing a First Java Application

Debugging Techniques

Testing Techniques

1.5.5 Making a JAR File

1.6 Chapter Summary

1.7 Exercises, Problems, and Projects

1.7.1 Multiple Choice Exercises

1.7.2 Converting Numbers

1.7.3 General Questions

1.7.4 Technical Writing

1.7.5 Group Project (for a group of 1, 2, or 3 students)

Chapter 2 Programming Building Blocks— Java Basics

Introduction

2.1 Java Application Structure

2.2 Data Types, Variables, and Constants

2.2.1 Declaring Variables

2.2.2 Integer Data Types

2.2.3 Floating-Point Data Types

2.2.4 Character Data Type

2.2.5 Boolean Data Type

2.2.6 The Assignment Operator, Initial Values, and Literals

2.2.7 String Literals and Escape Sequences

2.2.8 Text Blocks

2.2.9 Constants

2.3 Expressions and Arithmetic Operators

2.3.1 The Assignment Operator and Expressions

2.3.2 Arithmetic Operators

2.3.3 Operator Precedence

2.3.4 Programming Activity 1: Converting Inches to Centimeters

2.3.5 Integer Division and Modulus

2.3.6 Division by Zero

2.3.7 Mixed-Type Arithmetic and Type Casting

2.3.8 Shortcut Operators

2.4 Programming Activity 2: Temperature Conversion

2.5 Chapter Summary

2.6 Exercises, Problems, and Projects

2.6.1 Multiple Choice Exercises

2.6.2 Reading and Understanding Code

2.6.3 Fill In the Code

2.6.4 Identifying Errors in Code

2.6.5 Debugging Area—Using Messages from the Java Compiler and Java JVM

2.6.6 Write a Short Program

2.6.7 Programming Projects

2.6.8 Technical Writing

Chapter 3 Object-Oriented Programming, Part 1: Using Classes

Introduction

3.1 Class Basics and Benefits

3.2 Creating Objects Using Constructors

3.3 Calling Methods

3.4 Using Object References

3.5 More on the String Class

The length Method

The charAt Method

The indexOf Methods

The substring Methods

The isBlank and strip Methods

String Processing

3.6 Programming Activity 1: Calling Methods

3.7 The Java Class Library

3.8 Formatting Output with the DecimalFormat Class

3.9 Generating Random Numbers with the Random Class

3.10 Input from the Console Using the Scanner Class

3.11 Calling Static Methods and Using Static Class Variables

3.12 Using System.in and System.out

3.13 The Math Class

The pow Method

The round Method

The min and max Methods

3.14 Formatting Output with the NumberFormat Class

3.15 The Integer, Double, Character, and Other Wrapper Classes

3.16 Programming Activity 2: Using Predefined Classes

3.17 Chapter Summary

3.18 Exercises, Problems, and Projects

3.18.1 Multiple Choice Exercises

3.18.2 Reading and Understanding Code

3.18.3 Fill In the Code

3.18.4 Identifying Errors in Code

3.18.5 Debugging Area—Using Messages from the Java Compiler and Java JVM

3.18.6 Write a Short Program

3.18.7 Programming Projects

3.18.8 Technical Writing

3.18.9 Group Project (for a group of 1, 2, or 3 students)

Chapter 4 Introduction to Graphical Applications

Introduction

4.1 JavaFX Application Structure

4.2 The Graphics Coordinate System and Color

4.3 Drawing Shapes and Text

4.4 Drawing Custom Shapes

4.5 Programming Activity 1: Writing an Application with Graphics

4.6 Chapter Summary

4.7 Exercises, Problems, and Projects

4.7.1 Multiple Choice Exercises

4.7.2 Reading and Understanding Code

4.7.3 Fill In the Code

4.7.4 Identifying Errors in Code

4.7.5 Debugging Area—Using Messages from the Java Compiler and Java JVM

4.7.6 Write a Short Program

4.7.7 Programming Projects

4.7.8 Technical Writing

4.7.9 Group Project (for a group of 1, 2, or 3 students)

Chapter 5  Flow of Control, Part 1: Selection

Introduction

5.1 Forming Conditions

5.1.1 Equality Operators

5.1.2 Relational Operators

5.1.3 Logical Operators

DeMorgan’s Laws

5.2 Simple Selection with if

5.3 Selection Using if/else

Block Scope

5.4 Selection Using if/else if

5.5 Sequential and Nested if/else Statements

5.5.1 Sequential if/else Statements

Finding the Minimum or Maximum Values

5.5.2 Nested if/else Statements

Dangling else

5.6 Testing Techniques for if/else Statements

5.7 Programming Activity 1: Working with if/else

5.8 Comparing Floating-Point Numbers

5.9 Comparing Objects

5.9.1 The equals Method

5.9.2 String Comparison Methods

5.10 The Conditional Operator (?:)

5.11 The switch Statement

5.12 Programming Activity 2: Using the switch Statement

5.13 Chapter Summary

5.14 Exercises, Problems, and Projects

5.14.1 Multiple Choice Exercises

5.14.2 Reading and Understanding Code

5.14.3 Fill In the Code

5.14.4 Identifying Errors in Code

5.14.5 Debugging Area—Using Messages from the Java Compiler and Java JVM

5.14.6 Write a Short Program

5.14.7 Programming Projects

5.14.8 Technical Writing

5.14.9 Group Project (for a group of 1, 2, or 3 students)

Chapter 6  Flow of Control, Part 2: Looping

Introduction

6.1 Event-Controlled Loops Using while

6.2 General Form for while Loops

6.3 Event-Controlled Looping

6.3.1 Reading Data from the User

6.3.2 Reading Data from a Text File

6.4 Looping Techniques

6.4.1 Accumulation

6.4.2 Counting Items

6.4.3 Calculating an Average

6.4.4 Finding Maximum or Minimum Values

6.5 Type-Safe Input Using Scanner

6.6 Constructing Loop Conditions

6.7 Testing Techniques for while Loops

6.8 Event-Controlled Loops Using do/while

6.9 Programming Activity 1: Using while Loops

Task Instructions

Troubleshooting

6.10 Count-Controlled Loops Using for

6.10.1 Basic Structure of for Loops

6.10.2 Constructing for Loops

6.10.3 Testing Techniques for for Loops

6.11 Nested Loops

6.12 Programming Activity 2: Using for Loops

Instructions

Troubleshooting

6.13 Chapter Summary

6.14 Exercises, Problems, and Projects

6.14.1 Multiple Choice Exercises

6.14.2 Reading and Understanding Code

6.14.3 Fill In the Code

6.14.4 Identifying Errors in Code

6.14.5 Debugging Area—Using Messages from the Java Compiler and Java JVM

6.14.6 Write a Short Program

6.14.7 Programming Projects

6.14.8 Technical Writing

6.14.9 Group Project (for a group of 1, 2, or 3 students)

Chapter 7  Object-Oriented Programming, Part 2: User-Defined Classes

Introduction

7.1 Defining a Class

7.2 Defining Instance Variables

7.3 Writing Class Methods

7.4 Writing Constructors

7.5 Writing Accessor Methods

7.6 Writing Mutator Methods

7.7 Writing Data Manipulation Methods

7.8 Programming Activity 1: Writing a Class Definition, Part 1

7.9 The Object Reference this

7.10 The toString and equals Methods

7.11 Static Class Members

7.12 Another Example: The Rational Class

7.13 Graphical Objects

7.14 Enumeration Types

7.15 Programming Activity 2: Writing a Class Definition, Part 2

7.16 Creating Packages

7.17 Generating Web-Style Documentation with Javadoc

7.18 Chapter Summary

7.19 Exercises, Problems, and Projects

7.19.1 Multiple Choice Exercises

7.19.2 Reading and Understanding Code

7.19.3 Fill In the Code

7.19.4 Identifying Errors in Code

7.19.5 Debugging Area—Using Messages from the Java Compiler and Java JVM

7.19.6 Write a Short Program

7.19.7 Programming Projects

7.19.8 Technical Writing

7.19.9 Group Project (for a group of 1, 2, or 3 students)

Chapter 8 Single-Dimensional Arrays

Introduction

8.1 Declaring and Instantiating Arrays

8.1.1 Declaring Arrays

8.1.2 Instantiating Arrays

8.1.3 Combining the Declaration and Instantiation of Arrays

8.1.4 Assigning Initial Values to Arrays

8.2 Accessing Array Elements

8.3 Aggregate Array Operations

8.3.1 Printing Array Elements

8.3.2 Reading Data into an Array

8.3.3 Summing the Elements of an Array

8.3.4 Finding Maximum or Minimum Values

8.3.5 Copying Arrays

8.3.6 Changing the Size of an Array

8.3.7 Comparing Arrays for Equality

8.3.8 Displaying Array Data as a Bar Chart

8.4 Programming Activity 1: Working with Arrays

Instructions

Troubleshooting

8.5 Using Arrays in Classes

8.5.1 Using Arrays in User-Defined Classes

8.5.2 Retrieving Command Line Arguments

8.6 Searching and Sorting Arrays

8.6.1 Sequential Search of an Unsorted Array

8.6.2 Selection Sort

8.6.3 Insertion Sort

8.6.4 Sorting Arrays of Objects

8.6.5 Sequential Search of a Sorted Array

8.6.6 Binary Search of a Sorted Array

8.7 Programming Activity 2: Searching and Sorting Arrays

Instructions

Troubleshooting

8.8 Using Arrays as Counters

8.9 Methods Accepting a Variable Number of Arguments

8.10 Chapter Summary

8.11 Exercises, Problems, and Projects

8.11.1 Multiple Choice Exercises

8.11.2 Reading and Understanding Code

8.11.3 Fill In the Code

8.11.4 Identifying Errors in Code

8.11.5 Debugging Area—Using Messages from the Java Compiler and Java JVM

8.11.6 Write a Short Program

8.11.7 Programming Projects

8.11.8 Technical Writing

8.11.9 Group Project (for a group of 1, 2, or 3 students)

Chapter 9 Multidimensional Arrays and the ArrayList and HashMap Classes

Introduction

9.1 Declaring and Instantiating Multidimensional Arrays

9.1.1 Declaring Multidimensional Arrays

9.1.2 Instantiating Multidimensional Arrays

9.1.3 Combining the Declaration and Instantiation of Multidimensional Arrays

9.1.4 Assigning Initial Values to Multidimensional Arrays

9.2 Accessing Multidimensional Array Elements

9.3 Aggregate Two-Dimensional Array Operations

9.3.1 Processing All the Elements of a Two-Dimensional Array

9.3.2 Processing a Given Row of a Two-Dimensional Array

9.3.3 Processing a Given Column of a Two-Dimensional Array

9.3.4 Processing a Two-Dimensional Array One Row at a Time

9.3.5 Processing a Two-Dimensional Array One Column at a Time

9.3.6 Displaying Two-Dimensional Array Data as a Bar Chart

9.4 Two-Dimensional Arrays Passed to and Returned from Methods

9.5 Programming Activity 1: Working with Two-Dimensional Arrays

Instructions

Troubleshooting

9.6 Other Multidimensional Arrays

9.7 The ArrayList Class

9.7.1 Declaring and Instantiating ArrayList Objects

9.7.2 Methods of the ArrayList Class

9.7.3 Looping Through an ArrayList Using an Enhanced for Loop

9.7.4 Using the ArrayList Class in a Program

9.8 Programming Activity 2: Working with the ArrayList Class

Instructions

Troubleshooting

9.9 The HashMap Class

9.9.1 Declaring and Instantiating HashMap Objects

9.9.2 Methods of the HashMap Class

9.9.3 Using the HashMap in a Program

9.10 Chapter Summary

9.11 Exercises, Problems, and Projects

9.11.1 Multiple Choice Exercises

9.11.2 Reading and Understanding Code

9.11.3 Fill In the Code

9.11.4 Identifying Errors in Code

9.11.5 Debugging Area—Using Messages from the Java Compiler and Java JVM

9.11.6 Write a Short Program

9.11.7 Programming Projects

9.11.8 Technical Writing

9.11.9 Group Project (for a group of 1, 2, or 3 students)

Chapter 10  Object-Oriented Programming, Part 3: Inheritance, Polymorphism, and Interfaces

Introduction

10.1 Inheritance

10.2 Inheritance Design

10.2.1 Inherited Members of a Class

10.2.2 Subclass Constructors

10.2.3 Adding Specialization to the Subclass

10.2.4 Overriding Inherited Methods

10.3 The protected Access Modifier

10.4 Programming Activity 1: Using Inheritance

Instructions

10.5 Abstract Classes and Methods

10.6 Polymorphism

10.7 Programming Activity 2: Using Polymorphism

Instructions

10.8 Interfaces

10.9 Chapter Summary

10.10 Exercises, Problems, and Projects

10.10.1 Multiple Choice Exercises

10.10.2 Reading and Understanding Code

10.10.3 Fill In the Code

10.10.4 Identifying Errors in Code

10.10.5 Debugging Area—Using Messages from the Java Compiler and Java JVM

10.10.6 Write a Short Program

10.10.7 Programming Projects

10.10.8 Technical Writing

10.10.9 Group Project (for a group of 1, 2, or 3 students)

Chapter 11  Exceptions and Input/Output Operations

Introduction

11.1 Simple Exception Handling

11.2 Catching Multiple Exceptions

11.3 Reading Text Files Using Scanner

11.4 The java.io Package

11.5 Recovering from an Exception

11.6 Writing and Appending to Text Files

11.6.1 Writing to Text Files

11.6.2 Appending to Text Files

11.7 Reading Structured Text Files

11.7.1 Parsing a String Using Scanner

11.7.2 Reading Structured Data Using Scanner

11.8 Programming Activity 1: Reading from a Structured Text File

Instructions

If you have time

Troubleshooting

11.9 Streams

11.10 Reading Formatted Open Data from a Remote Location

11.10.1 Accessing Remote Data

11.10.2 JSON Formatting and Parsing

11.10.3 Reading, Parsing, Streaming, and Processing Remote Data

11.11 Reading and Writing Objects to a File

11.11.1 Writing Objects to Files

11.11.2 Reading Objects from Files

11.12 Programming Activity 2: Reading Objects from a File

Task Instructions: Reading from the transactions.obj File

If you have time

Troubleshooting

11.13 User-Defined Exceptions

11.14 Chapter Summary

11.15 Exercises, Problems, and Projects

11.15.1 Multiple Choice Exercises

11.15.2 Reading and Understanding Code

11.15.3 Fill In the Code

11.15.4 Identifying Errors in Code

11.15.5 Debugging Area—Using Messages from the Java Compiler and Java JVM

11.15.6 Write a Short Program

11.15.7 Programming Projects

11.15.8 Technical Writing

11.15.9 Group Project (for groups of 2, 3, or more students)

Chapter 12 Recursion

Introduction

12.1 Simple Recursion: Identifying the General and Base Cases

12.2 Recursion with a Return Value

12.2.1 Computing the Factorial of a Number

12.2.2 Computing the Greatest Common Divisor

12.3 Recursion with Two Base Cases

12.4 Programming Activity 1: Checking for a Palindrome

Instructions

Task Instructions

Troubleshooting

12.5 Simple Recursion on an Array

12.6 Binary Search: A Recursive Solution

12.7 Programming Activity 2: The Towers of Hanoi

Instructions

Task Instructions

Troubleshooting

12.8 Merge Sort

12.9 Quick Sort

12.10 Recursion Versus Iteration

12.11 Chapter Summary

12.12 Exercises, Problems, and Projects

12.12.1 Multiple Choice Exercises

12.12.2 Reading and Understanding Code

12.12.3 Fill In the Code

12.12.4 Identifying Errors in Code

12.12.5 Debugging Area—Using Messages from the Java Compiler and Java JVM

12.12.6 Write a Short Program

12.12.7 Programming Projects

12.12.8 Technical Writing

12.12.9 Group Projects (for a group of 1, 2, or 3 students)

Chapter 13  An Introduction to Data Structures

Introduction

13.1 Linked Lists

13.1.1 Linked-List Concepts and Structure

13.1.2 Linked-List Basics

13.1.3 Methods of a Linked List

13.1.4 Testing a Linked-List Class

13.2 Linked Lists of Objects

13.2.1 A Linked-List Shell

13.2.2 Generating an Exception

13.2.3 Other Methods of a Linked List

13.2.4 Testing a Linked-List Class

13.3 Implementing a Stack Using a Linked List

13.4 Implementing a Queue Using a Linked List

13.5 Array Representation of Stacks

13.6 Programming Activity 1: Writing Methods for a Stack Class

Instructions

Troubleshooting

13.7 Array Representation of Queues

13.8 Sorted Linked Lists

13.9 Programming Activity 2: Writing Insert and Delete Methods for a Sorted Linked List

Instructions

Troubleshooting

13.10 Doubly Linked Lists

13.11 Linked Lists Using Generic Types

13.12 Recursively Defined Linked Lists

13.13 Chapter Summary

13.14 Exercises, Problems, and Projects

13.14.1 Multiple Choice Exercises

13.14.2 Reading and Understanding Code

13.14.3 Fill In the Code

13.14.4 Identifying Errors in Code

13.14.5 Debugging Area—Using Messages from the Java Compiler and Java JVM

13.14.6 Write a Short Program

13.14.7 Programming Projects

13.14.8 Technical Writing

13.14.9 Group Project (for a group of 1, 2, or 3 students)

Chapter 14 Running Time Analysis

Introduction

14.1 Orders of Magnitude and Big-Oh Notation

14.2 Running Time Analysis of Algorithms: Counting Statements

14.3 Running Time Analysis of Algorithms and Impact of Coding: Evaluating Recursive Methods

Handwaving Method

Iterative Method

Proof by Induction Method

Other Methods

14.4 Programming Activity: Tracking How Many Statements Are Executed by a Method

Instructions

Troubleshooting

14.5 Running Time Analysis of Searching and Sorting Algorithms

14.6 Simulation of Various Sorting Algorithms

14.7 Chapter Summary

14.8 Exercises, Problems, and Projects

14.8.1 Multiple Choice Exercises

14.8.2 Compute the Running Time of a Method

14.8.3 Programming Projects

14.8.4 Technical Writing

14.8.5 Group Project (for a group of 1, 2, or 3 students)

Chapter 15 General Trees, Binary Trees, and Binary Search Trees

Introduction

15.1 Trees

15.2 Binary Trees

15.3 Binary Tree Implementation

15.4 Programming Activity 1: Working with Binary Trees

Instructions

Troubleshooting

15.5 Binary Search Trees

15.5.1 Searching in a Binary Search Tree

15.5.2 Inserting in a Binary Search Tree

15.5.3 Deleting from a Binary Search Tree

15.6 Binary Search Tree Implementation

15.7 Rebalancing a Binary Search Tree

15.8 Programming Activity 2: Working with Binary Search Trees

Instructions

Troubleshooting

15.9 Chapter Summary

15.10 Exercises, Problems, and Projects

15.10.1 Multiple Choice Exercises

15.10.2 Reading and Understanding Code

15.10.3 Fill In the Code

15.10.4 Identifying Errors in Code

15.10.5 Debugging Area—Using Messages from the Java Compiler and Java JVM

15.10.6 Write a Short Program

15.10.7 Programming Projects

15.10.8 Technical Writing

15.10.9 Group Project (for a group of 1,2, or 3 students)

Chapter 16 Graphical User Interfaces (available online in the eBook)

Chapter 17 Graphical User Interfaces Using JavaFX (available online in the eBook)



Appendix A Java Reserved Words and Keywords

Appendix B Operator Precedence

Appendix C The Unicode Character Set

Appendix D Representing Negative Integers

Appendix E Representing Floating-Point Numbers (available online in the eBook)

Appendix F Solutions to Selected Exercises (available online in the eBook)

Index