CSE 373 Winter 2005

Homework #2

Anagrams and More...

Due:

electronically Thursday, Jan. 20 Sunday, Jan 23, 8:00 pm; paperwork at beginning of class Friday Monday.

Objectives

Description

There are two, unrelated parts.
I.  Exercises from the textbook.  Work out the answers on paper to hand in.  Aside from the exercises specifically assigned to turn in, you are encouraged to work as many as possible of other exercises from these and other chapters.  There is a web site with help and hints for some of the problems: java.datastructures.net.
Postponed.  Will be part of the next homework.

II. Programming.
A. Reorganize your code so that the classes are all in a package called "hw2"  (A new version of IAnagramChecker contains the correct package declaration).  You will need to add package declarations as well as moving the files into a directory with the proper name.  Instead of modifying your existing files and project, you may find it easier to create a new project with new files.
B. Resubmit AnagramChecker (from the Homework 1 version, but in the hw2 package, of course).  Make corrections as needed.  A couple of cases that were ambiguous before have been clarified (be sure to read the comments in the new version of IAnagramChecker).
C. Resubmit (corrected if necessary) AnagramTester (base it on the Homework 1 version, corrected and in the new package).
D. Redo your AnagramTester into a new class named AnagramTest.  This should be JUnit test class (extends TestCase). [The site www.junit.org has downloads and examples (though they tend to make it seem more complicated than it is).  A local copy of junit.jar, which must be available to the Java compiler, is with the other homework 2 files.]  In addition to testIsAnagram, write one or more methods to test findAnagrams.   Note: the emphasis in this part of the homework is getting familiar with JUnit.  The test cases you write here do not have to be as complete as you would be expected to do later.  Focus on getting JUnit to work.

Note that you will be turning in both AnagramTester and AnagramTest!

Turn in:

Electronically, the .java files, by 8:00 p.m. Thursday, January 20.
On paper, at beginning of class Friday, January 21: printouts of the programs (the preferred way to do this is to print the "receipt" you get back from the turn-in form), plus a short report which includes:
Please staple everything together.  There might not be a stapler in the classroom, so please do this in advance.  Make sure your name is on everything you turn in!  Your student ID is not needed unless we specifically request it.

Grading

Most of the grading points will come from
Correct structuring of the packaging
Good luck and have fun!


Notes
If you have questions along the way, either about the assignment or how to do things, feel free to discuss it on the Message Board.  Just don't give away code, or any crucial aspects of the solution.

Where applicable, write your code to be reusable and modifiable.  In a later homework, you might in fact have an opportunity to reuse or modify code from this one...