Homework 7 (Due 11:59pm Thursday, November 5, 2020)

Submit via SVN

Preliminaries

This homework should be done in Full Java (using DrJava, IntelliJ, Eclipse, or a text editor and command line compilation and execution).  The Functional Java language in DrJava regrettably no longer works for more complex OO code such as the visitor pattern.  In this assignment, you will re-implement each of the functions on IntLists assigned in Homework 7 using the visitor pattern.

As before, your program must support the object-oriented formulation of lists of integers defined the composite class hierarchy where

The Homework Support files IntList.java, IntListVisitor.java, LengthVisitor, ScalarProductVisitor, and IntListTest.java provide a starting point for your code.   Feel free to edit these files and omit files that are not needed in this homework assignment.

Problems

Apply the visitor design pattern to define visitor classes implementing the IntListVistor interface IntList and its subclasses given above to formulate all of the following methods as  visitorsJUnit test class, IntListTest to test all of your new methods in the IntList class.  Use the LengthVisitor example as a guide for defining your new visitor classes.  Augment the test clas IntListTest.java to include test methods for each of your visitor classes.  Confine your documentation to writing contracts (purpose statements in HTDP terminology) for each visitor using javadoc notation (a comment preceding the corresponding definition) beginning  with /** and closing  with */ for each visitor class.  Use the documentation of LengthVisitor in the Homework Support files as an example.