Please complete Exercise 4 (page 357), all 18 pieces, and Exercise 6 (page 384).
We can simulate parameter passing by keeping track of the caller activation frame. For this part of the Homework, you will simulate parameter passing to a simple function:
void test(Node n, int val) {
n = n.next;
val = val + 10;
}
You will use an interface Parameter which has methods to ``get''
and ``set'' the parameter as well as a method to ``complete'' the
parameter by performing any copy-back operation (for example, for
value-result parameters).
The test case, will set up a simple situation, create instances of the interface (see below) and then call the function which simulates the above function (using ``set'' and ``get'' calls). We provide the harness, all you need to do is implement the exception class and each of the following cases:
ParameterTest.java in the
src/homework9 directory. This directory also has files for
each of the following classes:
node.test.out) is also provided.
You submit your program work by putting it in the homework9 directory
in your AFS class volume.
You may do all your work in this directory, or you may wish to do your
work in a different directory and copy things when correct into this
directory. In any case, you will lose permission to write things in
this directory after the deadline, which is 4:00pm on Tuesday,
April 13th. In other words, you must be done before lecture
starts.
The homework9 directory should include the following: