Home > Store

Problem Solving with Java

Register your product to gain access to bonus material or receive a coupon.

Problem Solving with Java

Book

  • Sorry, this book is no longer in print.
Not for Sale

About

Features

  • Contains classic Koffman five-step problem-solving approach: (1) state problem, (2) analyze problem, (3) design algorithm, (4) implement, (5) test/verify.
  • Contains interviews with famous computer scientists so that students can get a glimpse into various fields and careers.

Description

  • Copyright 1999
  • Pages: 848
  • Edition: 1st
  • Book
  • ISBN-10: 0-201-35743-7
  • ISBN-13: 978-0-201-35743-1

Click for author interviews and demos of four SimpleGUI examples.

Object-Oriented Programming

This book presents a careful balance between traditional problem-solving techniques and object-oriented design. Embracing the object-oriented paradigm, the authors introduce objects early (Chapter 2) and use them throughout, introducing features as needed in a gentle manner. Chapters 4 - 7 focus on the traditional data and control structures, using objects as needed. Chapter 8 provides a more in-depth study of object-oriented design, providing detailed coverage of visibility, polymorphism, and inheritance.

Applications and Applets

Focusing on applications early, the book supports user interaction by providing a package called simpleIO. Applets are first introduced in Chapter 4 where the authors use them in an optional section on graphics to introduce the AWT and its features for drawing simple graphical patterns. They are studied extensively in Chapters 9 and 10 where the intricacies of the AWT, programming for the web, and GUI programming are covered.

Graphical User Interfaces (GUIs)

Starting in Chapter 2, the authors integrate a GUI library that allows students to better understand concepts through visualization and have some fun. GUI concepts are always presented in the context of good problem solving and program development. Optional sections on graphics appear starting in Chapter 4, again to spur student interest and keep them motivated.

Proven Software Development Process

The book conveys the relationship between good problem-solving skills and effective software development by consistently applying a proven software development method that has been adapted to the object-oriented paradigm.

Helpful Learning Features

The authors employ several features to enhance the usefulness of this book as a teaching tool. These include syntax displays, program style displays, end-of-section exercises, examples, case studies, error discussions, and chapter reviews. Also, interviews with famous computer scientists provide glimpses into various careers in computer science.



0201357437B04062001

Downloads

Source Code

You can browse or download the simpleIO package as well as the source code for all the programs that appear in the book. The file structure is:

psjava

simpleIO

sourceCode

Because of small technical glitches in compatibility between versions of the Java Abstract Windows Toolkit we provide source files only. Code has been tested using JDK 1.1.3 on Unix, CodeWarrior on Macintosh, JBUILDER and Semantic Cafe on Windows 95.

Browse the psjava folder

Download for Unix

Download for Macintosh

Download for Windows


Advice on Installing simpleIO

In order to use the classes and methods in the simpleIO package you must (1) compile the package, and (2) make the folder with the compiled classes accessible to the java compiler and application runner. Unfortunately this differs on the three popular platforms (Unix, Macintosh and Windows) as well as within different Integrated Programming Environments such as CodeWarrior, Semantic, Borland. These notes are intended to give you tips, rather than guide you through the process.

We use the JDK on Unix as an example. Other environments should include extensive print and on-line resources to help you adapt these instructions to your environment. This is the simplest way to set up the package. You, or your systems administrator may find more sophisticated ways to configure the structure.

1. We recommend that you keep the organization of the psjava folder we provide. Because simpleIO is a package, the compiler and runner will look for files such as simpleIO/SimpleGUI.class rather than SimpleGUI.class. If you keep the psjava structure you can reference "simpleIO/SimpleGUI.class" as shown in step 3.

2. To compile the package, make the psjava folder (directory) your working directory. In Unix, the command:

psjava% javac simpleIO/*.java

will compile the package, placing the .class files in the simpleIO folder. Note that psjava% is the Unix prompt.

3. You should create projects in separate folders. The sourceCode structure demonstrates how classes that work together are clustered in folders. For example, the folder psjava/sourceCode/Chapter02 contains two .java files. In order to reference the simpleIO support files you must set the CLASSPATH variable to the folder that contains them.

The quick and dirty (but space expensive) way to include the simpleIO package in a project folder is to create a sub-folder (subdirectory) called simpleIO. Copy the .class files that you created in step two from the psjava/simpleIO folder to this directory.

The more responsible solution is to set the CLASSPATH variable to search for the folder that contains the simpleIO package. A package corresponds to a folder (directory.) Thus the psjava folder contains the package simpleIO because the folder contains the simpleIO folder. The rule in Java is that the compiler and applications runner search for classes in the system structure by default. That is why they can always find classes from standard packages. If the CLASSPATH variable is not set, then the default path is the current working directory and any of its subdirectories. If the CLASSPATH variable is set, then you must explicitly include the current working directory in the search path so that your own project files will be found. In UNIX you set the class path as follows:

psjava%setenv CLASSPATH {the entire path}/psjava/:.

Note the ":" and "." at the end. This says the directory {....}/psjava/ will be in the path AND (:) so will the current directory (.). You must substitute your complete path to /psjava in the statement above. For example Ursula has a copy of the structure under her root:

psjava%setenv CLASSPATH ~wolz/psjava/:.


Errata and Update Information

Although we have tested, and retested the simpleIO package and the source code extensively, things slip through the cracks.

Please send mail to wolz@tcnj.edu if you run into problems or simply need clarification on something.

Erratta and update information can be found at: http://www.tcnj.edu/~wolz/psjava/update.html.

During Fall 1998, we will attempt to update the psjava (source code and simpleIO folders) as needed. The versionDate.html file provides the date of the most recent version.

Supplements

Click below for Supplements related to this title:
Supplements

Sample Content

Table of Contents

I. PROBLEM SOLVING AND PROGRAMMING WITH OBJECTS.

1. Introduction to Computers and Programming.
Overview of Computers.
Computer Components.
Computer Networks.
Overview of Programming Languages, Then and Now.
Processing a High-Level Language Program.
Problem Solving and Programming Using Classes.
Creating a Program in an Integrated Programming Environment.

Chapter Review.
2. Problem Solving and Java.
The Software Development Method.
Applying the Software Development Method.
Case Study: Converting Units of Measurement.
Overview of a Java Program.
Reserved Words and Identifiers.
Data Types.
Class Definitions.
Method Definitions.

Chapter Review.
3. Methods, Statements, and Expressions.
Method Bodies: Where the Action Takes Place.
Calling Methods.
Assignment Statements.
Operations and Expressions.
Processing Integers.
Case Study: Evaluating Coins.
Processing Strings.
Case Study: Pig Latin.
Writing Code with Style.
Common Errors and Debugging.

Chapter Review.
4. Program Design with Methods and Graphics.
Building Programs from Existing Information.
Case Study: Finding the Area and Circumference of a Circle.
Extending a Problem Solution.
Case Study: Finding the Most Pizza for Your Money.
Extending a Problem Solution through Inheritance.
Reuse of Methods in Class Math.
Accessors, Modifiers, Constructors, and Class Methods.
Introduction to Computer Graphics.
Common Programming Errors.

Chapter Review.

II. TRADITIONAL CONTROL AND DATA STRUCTURES.

5. Selection Structures.
Control Structures.
Boolean Expressions.
The if Statement.
if Statements with Compound Statements.
Decision Steps in Algorithms.
Case Study: Payroll Problem.
Case Study: Computing Insurance Dividends.
Hand Tracing an Algorithm.
Nested if Statements and Multiple-Alternative Decisions.
The switch Statement and Simple GUI Menus.
Exceptions and try-catch Blocks.
Common Programming Errors.

Chapter Review.
6. Repetition Structures.
Repetition in Programs: The while Statement.
Accumulating a Sum.
Case Study: Computing Company Payroll.
State-Controlled loops.
Case Study: A Checking Account Program.
Loop Design and do-while Loop.
The for Statement.
Case Study: Displaying a Temperature Table.
Loops in Graphics Programs (Optional).
Introduction to Recursive Methods.
Debugging and Testing Programs with Loops.
Common Programming Errors.

Chapter Review.
7. Arrays and Vectors.
Array Declarations and Indices.
Processing Arrays and Array Elements.
Case Study: Computing Statistics.
Operations on Whole Arrays.
Searching and Sorting an Array.
Analysis of Algorithms: Big-O Notation (Optional).
Arrays of Objects.
Case Study: Payroll Problem with an Employee Array.
Vectors.
More Input/Output: Using Files and display Row (Optional).
Multi-dimensional Arrays: Arrays of Arrays.
Common Programming Errors.

Chapter Review.

III. DESIGN FOR GUI AND NETWORK PROGRAMMING.

8. Object-Oriented Design.
Java Classes Revisited.
Case Study: A General Purpose Rectangle Class.
Modular Programming and Reuse.
Encapsulation, Inheritance, Visibility, and Packages.
Polymorphism.
Another Look at Inheritance.
Case Study: Is a Square a Rectangle?
Class Members and Instance Members: Static and Final.
Abstract Classes.
Case Study: Areas of Different Geometric Figures.
Multiple Inheritance and Interfaces.
Common Programming Errors.

Chapter Review.
9. Applets, Graphical-User Interfaces, and Threads.
Web Programming and Client, Server Model.
Applets, Panels, Containers, Components.
The Basic Interactive Applet.
Case Study: Click me.
Case Study: User-controlled Animation.
Introduction to Threads.
Case Study: Threaded Animation.
Browser, Applet Interaction.

Chapter Review.
10. GUIs as a Vehicle for Object-Oriented Design.
Abstraction Layers for User Input/Output.
Output to the User: Label, Canvas, Fonts, and Layout Managers.
Discrete User Input: Buttons, Boxes and Lists.
Continuous and Textual Input.
Low-Level User Input.
Turn Taking within the Event Model.
Case Study: TicTacToe.
Applications and Applets: Menus.

Chapter Review.

IV. MORE ADVANCED TRADITIONAL CONTROL AND DATA STRUCTURES.

11. Recursion.
Recursive Methods.
Argument and Local Variable Stacks.
Recursive Mathematical Functions.
Recursive Methods with Arrays and Vectors.
Case Study: Summing the Values in an Array.
Binary Search.
Case Study: Recursive Binary Search.
Problem Solving with Recursion.
Case Study: Towers of Hanoi Problem.
Common Programming Errors.

Chapter Review.
12. Linked Data Structures.
Linked Lists.
Stacks.
Queues.
Binary Trees.
Implementing a Binary Search Tree.
Efficiency of a Binary Search Tree.
Common Programming Errors.

Chapter Review.
Appendices.
Summary of the Essentials of the Language.
Pointers to On-line resources (Libraries, Learn HTML).
The Component Class and its Companions (for GUIs).
The IO package.
The Vector Class.
The String Class.
Primitive Types.
Object Wrappers for Primitive Types.
Unicode.
The Thread Class and the Runnable Interface. 0201357437T04062001

Updates

Errata

p. iii, Second paragraph ends with a footnote reference. The footnote is
missing.
p. ix  add dedication to Elliot and Ursula's families
p. 44 transpose yards and meters in third comment line in PieceOfFabric.
p. 44 change displayString to displayResult at end of Fig. 2.2.
p. 53  First line under Primitive Type double - change integral to integer
p. 57, transpose yards and meters in third comment line in PieceOfFabric.
p. 57 change displayString to displayResult at end of Fig. 2.5.
p. 72 transpose yards and meters in third comment line in PieceOfFabric.
p. 72 change displayString to displayResult at end of Fig. 3.1.
p. 85 add "the type on the left" to end of margin note
p. 95 exercise 2, place semicolon after each statement (a. - q.). Replace n.
(a repeat of f.) with  x = -y * a / b;
p. 100 in readCoins, delete private twice.
p. 105 delete import simpleIO.*;
p. 137  round(x)   Returns the integer value closest to x. Put double and
long on first line and float and int on second line. (Type double argument
gives type long result; type float argument gives type int result.)
p. 147  delete import java.io.*;
p. 159  change line above Drawing Filled Figures to int y2 = 20;
p. 162  Change Fig. 4.37 caption to Class Pirate
p. 164  Exercise 4, call to method fillArc needs another argument, add , 150
to argument list.
p. 220  Exercise 3.  Delete word a before dice.
p. 222  in line above syntax display, delete , boolean values
p. 223  change Note 4: The selector type can be any ordinal type except
boolean.
p. 229  The space before darn should be in left brace. The bracket at the
end of the line should be a close parenthesis.
p. 244 Change "oversees" to "overseas" in the biography column 
p. 256  Change last word of first paragraph under Testing from myCompany to
mine.
p. 260  In exercise 1, change computePayTotals to displayPayTotals.
p. 267  Add { to end of first line.
p. 277, 279, 281  change running head to 6.5  The for Statement
p. 288 Delete period in "import.java.awt.*;" in 6th line of code
p. 357  In method writeArrayToFile, in the for loop heading, change <= to <.
p. 358  Add line:   employees = new Employee[arraySize];   after first line.
  Add line:   employees[count] = new Employee();   as first line of while
loop.
p. 362  In Example 7.1, draw arrow from matrix[1][2] to box with value 0.0.
p. 386  Add sentence "The statement below uses this constructor." to
paragraph above line that begins // Creates a new object Sigma . In line below
this one, delete word int two times.
p. 388  change third line in Fig. 8.2 continued to: return 2 * (length +
width);
p. 399 Change "part of" to "importing" in fifth line of code
p. 422  In first method rand, in line beginning with return, change max to
(max - min + 1).
p. 424, in self-check exercise 2 change max to (max - min + 1).
p. 435 In example 8.10, second line, change (just the border color) to (the
interior color).
p. 438 Change extends Triangle to extends DrawableTri two times.
p. 461  In line that begins // Create each component Sigma change name panel to
selections panel.
p. 484  Change // Yield is static Sigma to // yield is static Sigma
p. 498  Insert ap. Before getParameter.
p. 512 Transpose TextArea and TextField in left hand column
p. 516  In first constructor, insert after pen = p; the line: xSpace = x;  
ySpace = y;
p. 555  First paragraph, change last sentence to: Appendix D summarizes
MouseEvent methods to figure out which Sigma
p. 556  Delete sentence in parentheses at end of first paragraph.
p. 566  Delete line int r, c; in method gameOver.
p. 570  Programming exercise 1, change reference to Self-Check Exercise 2.
p. 618  In Fig. 11.26 User history, change B to C and C to B.
p. 636, Fig. 12.9   draw a black diagonal line in the link field of the last
list node (box under the word "box").
p. 638, first line, change showListTraversal to showList to match text at
end of p. 636.
p. 709 Word "Double" should appear in blue
p. 711 Word "Integer" should appear in blue
p. 715 Header "The Object Class" should appear in smaller font
p. 793  Section 3.4, exercise 1. part d.  change to  -4/16 = 0    16/-4 = -4
p. 794  exercise 7. Parts d and e, delete quotes around T.
p. 800  Section 6.1, exercise 1, 4 output lines should be 9, 81, 6561


1/18/99

Submit Errata

More Information

InformIT Promotional Mailings & Special Offers

I would like to receive exclusive offers and hear about products from InformIT and its family of brands. I can unsubscribe at any time.

Overview


Pearson Education, Inc., 221 River Street, Hoboken, New Jersey 07030, (Pearson) presents this site to provide information about products and services that can be purchased through this site.

This privacy notice provides an overview of our commitment to privacy and describes how we collect, protect, use and share personal information collected through this site. Please note that other Pearson websites and online products and services have their own separate privacy policies.

Collection and Use of Information


To conduct business and deliver products and services, Pearson collects and uses personal information in several ways in connection with this site, including:

Questions and Inquiries

For inquiries and questions, we collect the inquiry or question, together with name, contact details (email address, phone number and mailing address) and any other additional information voluntarily submitted to us through a Contact Us form or an email. We use this information to address the inquiry and respond to the question.

Online Store

For orders and purchases placed through our online store on this site, we collect order details, name, institution name and address (if applicable), email address, phone number, shipping and billing addresses, credit/debit card information, shipping options and any instructions. We use this information to complete transactions, fulfill orders, communicate with individuals placing orders or visiting the online store, and for related purposes.

Surveys

Pearson may offer opportunities to provide feedback or participate in surveys, including surveys evaluating Pearson products, services or sites. Participation is voluntary. Pearson collects information requested in the survey questions and uses the information to evaluate, support, maintain and improve products, services or sites, develop new products and services, conduct educational research and for other purposes specified in the survey.

Contests and Drawings

Occasionally, we may sponsor a contest or drawing. Participation is optional. Pearson collects name, contact information and other information specified on the entry form for the contest or drawing to conduct the contest or drawing. Pearson may collect additional personal information from the winners of a contest or drawing in order to award the prize and for tax reporting purposes, as required by law.

Newsletters

If you have elected to receive email newsletters or promotional mailings and special offers but want to unsubscribe, simply email information@informit.com.

Service Announcements

On rare occasions it is necessary to send out a strictly service related announcement. For instance, if our service is temporarily suspended for maintenance we might send users an email. Generally, users may not opt-out of these communications, though they can deactivate their account information. However, these communications are not promotional in nature.

Customer Service

We communicate with users on a regular basis to provide requested services and in regard to issues relating to their account we reply via email or phone in accordance with the users' wishes when a user submits their information through our Contact Us form.

Other Collection and Use of Information


Application and System Logs

Pearson automatically collects log data to help ensure the delivery, availability and security of this site. Log data may include technical information about how a user or visitor connected to this site, such as browser type, type of computer/device, operating system, internet service provider and IP address. We use this information for support purposes and to monitor the health of the site, identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents and appropriately scale computing resources.

Web Analytics

Pearson may use third party web trend analytical services, including Google Analytics, to collect visitor information, such as IP addresses, browser types, referring pages, pages visited and time spent on a particular site. While these analytical services collect and report information on an anonymous basis, they may use cookies to gather web trend information. The information gathered may enable Pearson (but not the third party web trend services) to link information with application and system log data. Pearson uses this information for system administration and to identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents, appropriately scale computing resources and otherwise support and deliver this site and its services.

Cookies and Related Technologies

This site uses cookies and similar technologies to personalize content, measure traffic patterns, control security, track use and access of information on this site, and provide interest-based messages and advertising. Users can manage and block the use of cookies through their browser. Disabling or blocking certain cookies may limit the functionality of this site.

Do Not Track

This site currently does not respond to Do Not Track signals.

Security


Pearson uses appropriate physical, administrative and technical security measures to protect personal information from unauthorized access, use and disclosure.

Children


This site is not directed to children under the age of 13.

Marketing


Pearson may send or direct marketing communications to users, provided that

  • Pearson will not use personal information collected or processed as a K-12 school service provider for the purpose of directed or targeted advertising.
  • Such marketing is consistent with applicable law and Pearson's legal obligations.
  • Pearson will not knowingly direct or send marketing communications to an individual who has expressed a preference not to receive marketing.
  • Where required by applicable law, express or implied consent to marketing exists and has not been withdrawn.

Pearson may provide personal information to a third party service provider on a restricted basis to provide marketing solely on behalf of Pearson or an affiliate or customer for whom Pearson is a service provider. Marketing preferences may be changed at any time.

Correcting/Updating Personal Information


If a user's personally identifiable information changes (such as your postal address or email address), we provide a way to correct or update that user's personal data provided to us. This can be done on the Account page. If a user no longer desires our service and desires to delete his or her account, please contact us at customer-service@informit.com and we will process the deletion of a user's account.

Choice/Opt-out


Users can always make an informed choice as to whether they should proceed with certain services offered by InformIT. If you choose to remove yourself from our mailing list(s) simply visit the following page and uncheck any communication you no longer want to receive: www.informit.com/u.aspx.

Sale of Personal Information


Pearson does not rent or sell personal information in exchange for any payment of money.

While Pearson does not sell personal information, as defined in Nevada law, Nevada residents may email a request for no sale of their personal information to NevadaDesignatedRequest@pearson.com.

Supplemental Privacy Statement for California Residents


California residents should read our Supplemental privacy statement for California residents in conjunction with this Privacy Notice. The Supplemental privacy statement for California residents explains Pearson's commitment to comply with California law and applies to personal information of California residents collected in connection with this site and the Services.

Sharing and Disclosure


Pearson may disclose personal information, as follows:

  • As required by law.
  • With the consent of the individual (or their parent, if the individual is a minor)
  • In response to a subpoena, court order or legal process, to the extent permitted or required by law
  • To protect the security and safety of individuals, data, assets and systems, consistent with applicable law
  • In connection the sale, joint venture or other transfer of some or all of its company or assets, subject to the provisions of this Privacy Notice
  • To investigate or address actual or suspected fraud or other illegal activities
  • To exercise its legal rights, including enforcement of the Terms of Use for this site or another contract
  • To affiliated Pearson companies and other companies and organizations who perform work for Pearson and are obligated to protect the privacy of personal information consistent with this Privacy Notice
  • To a school, organization, company or government agency, where Pearson collects or processes the personal information in a school setting or on behalf of such organization, company or government agency.

Links


This web site contains links to other sites. Please be aware that we are not responsible for the privacy practices of such other sites. We encourage our users to be aware when they leave our site and to read the privacy statements of each and every web site that collects Personal Information. This privacy statement applies solely to information collected by this web site.

Requests and Contact


Please contact us about this Privacy Notice or if you have any requests or questions relating to the privacy of your personal information.

Changes to this Privacy Notice


We may revise this Privacy Notice through an updated posting. We will identify the effective date of the revision in the posting. Often, updates are made to provide greater clarity or to comply with changes in regulatory requirements. If the updates involve material changes to the collection, protection, use or disclosure of Personal Information, Pearson will provide notice of the change through a conspicuous notice on this site or other appropriate way. Continued use of the site after the effective date of a posted revision evidences acceptance. Please contact us if you have questions or concerns about the Privacy Notice or any objection to any revisions.

Last Update: November 17, 2020