Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 4.0

Homework 08 (Due

...

10:00am Friday, March

...

19,

...

2010)

Submit via Owl-Space

Preliminaries

...

Composite Design Pattern for List

HTML
<ol>

...

  1. Write the arrangements (permutations) function from

...

  1. HTDP problem 12.4.2 in HW2 as a Java method for a Word class provided

...

  1. in the file Word.dj1. This file includes definitions of the composite pattern classes

...

  1. Word and WordList. Decompose the problem in exactly the same form as

...

  1. this solution to problem 12.4.2

...

  1. . We are providing

...

  1. skeletons for the classes Word and WordList in the file WordList.dj1

...

  1. ; use them.

...

  1. Write the mergesort function from the last problem in HW4 (using exactly the same top-down approach described in HW4) as a Java method in the

...

  1. composite pattern class ComparableList provided in the file ComparableList.dj1

...

  1. .
HTML
<li>
  1. Do Exercise 21.2.3 from HTDP using the Java composite pattern class ObjectList provided in the file ObjectList.dj1

...

  1. . This file includes the interface Predicate, which is the type of Java function arguments passed to the filter method, and abstract method stubs for filter, eliminateExp, recall, and selection . Exercise 21.2.3 provides Scheme code for the filter function which you should directly translate to the corresponding Java method code in ObjectList. Note that your filter method should work for arbitrary ObjectLists. In coding the methods eliminateExp, recall, and selection, use the Java type Number (compared using method doubleValue

...

  1. in place of the Scheme

...

  1. number type and

...

  1. the Java type Object in place of the Scheme symbol type. The method doubleValue() in Number returns the value of this converted to a double. You will need to cast the Object input of the test method to type Number when filtering lists of numbers.
HTML
<li>
  1. Do Problem 2 from Homework 5 in Java using the composite hierarchy of classes provided in the file

...

  1. ArithExpr.dj1

...

  1. .

...