CSC2310 Assignment 7 25 points due 11/17/01 Dr. Harrison Fall 2001
This assignment will test your ability to write classes. It is the second of three related assignments.
Write the classes for comparing Strings. Design the class or classes that implement the following tasks.
A) Lexographic (alphabetical order). Write a method that returns the first of two supplied strings. (i.e. String first_alphabetical( "b", "a") returns "a" because "a" is first in alphabetical order). Write another method that returns second as well. You can use the String CompareTo method.
B) Distance between strings. Write a method that returns an integer describing the number of differences between two words. For example when called with "three" and "there" it returns 2. (Ideally you would return the full edit distance including insertions and deletions, but this is hard and anyone who does it gets 30 points).
Write a test program and apply it to the following pairs of words:
|
Word 1 |
Word 2 |
Lowest |
Distance |
|---|---|---|---|
|
hello |
help |
|
|
|
clown |
clone |
|
|
|
there |
their |
|
|
|
where |
there |
|
|
|
shirty |
thirty |
|
|
|
antidisestablishmentarianism |
establish |
|
|
Have it output the words, the lowest order word and the distance between them.
The sources and output for the programs should be printed and the sources and class files should be supplied on a disk. Please label your work.