CSSE 220 -- Object-oriented Software Development

Homework 27 Due at 8:05 AM on Day 28

  1. Read a few short items on Serialization and networking on the web.  Links are on the schedule page.  You do not have to understand every detail from these articles, but you should get the main ideas before next class.
  2. Continue thinking about and writing the spell checker program.  Work with your team.  You should have something working to demonstrate in class on Day 28.
  3. Do the following two written problems.  You can write them by hand, or do them on your computer and  print them out.  Bring a printed copy to the Day 28 class.

(15 points) Weiss exercise 6.2. You can just write the code for part (a) out by hand if you wish, but I recommend getting it working in Eclipse and printing out your code. Here is some code that you can use to test your method if you wish:

public static void main(String[] args) {
  Collection<Collection<String>> a = new ArrayList<Collection<String>>();

  String[][] arrays = {{"abc", "def", "ghi"},
                       {"xyz", "uvw", "abc", "abc"},
                       {"a", "ab", "abc", "xyz", "abc"}};

  for (String[] sArray : arrays){
    Collection<String> a1 = new ArrayList<String>();
    for (String s: sArray)
      a1.add(s);
    a.add(a1);
  }
  System.out.println(count(a, "abc"));
}

2. (5 points) Weiss exercise 6.4. Note that by "less than quadratic time", we mean O(n log n).

  • Do the following written problemsHowever, these last two do not have to be turned in.  You should do them to your own satisfaction, then check the solutions that I will post.
  • 1. Weiss Exercise 6.7

    2. Weiss Exercise 6.18

    Your program should read strings (one per line) form standard input, and write Strings (one per line) to standard output.  The alphabetical part of the sort should ignore case.  Hint: Use java.util.Collections.sort(). 

    SAMPLE RUN:

    Enter the strings, one per line (CRTL Z to end):
    Come
    and
    sit
    by
    my
    side,
    if
    you
    love
    me
    Do
    not
    hasten
    to
    bid
    me
    adieu
    Just
    remember
    the
    Red
    River
    Valley
    And
    the
    cowboy
    who
    loved
    you
    so
    true

    SORTED LIST OF STRINGS:
    by
    Do
    if
    me
    me
    my
    so
    to
    and
    And
    bid
    not
    Red
    sit
    the
    the
    who
    you
    you
    Come
    Just
    love
    true
    adieu
    loved
    River
    side,
    cowboy
    hasten
    Valley

    Remember