This assignment is due on Friday, February 14. Don't wait until the weekend; there's a fair bit to do here.

(a) Look again at Chapter 6 of Goodrich and Tamassia. Write out answers to problems R-6.1 and R-6.2.

(b) Code up Alex Thornton's Project #4 from ICS 22, available on the web at http://www.ics.uci.edu/~thornton/ics22/LabManual/Simple/ . This project lets you write a tiny little interpreter for a tiny little programming language (though the job isn't so tiny that it won't take you the extra few days we've allowed). What you may not realize is that Facile, Alex's simple language, is essentially equivalent to Java! We'll talk later this quarter about the notion of "Turing equivalence," but except for the fact that Facile has a small, fixed number of variables, there aren't any algorithms you can code in Java that you can't code in Facile. (Of course, Turing equivalence doesn't say anything about programmer convenience, efficiency, safety, flexibility, and so on.)

There's one part of Alex's assignment that is strictly optional for H22, though: the use of JUnit for testing. Of course you need to test your code thoroughly and demonstrate your tests, but you don't need to use JUnit to do that.

(c) Here is some Facile code (that uses some of Alex's additional features). What does it do? (Try to figure it out by reading it rather than by running it.)

LET N 5

LET F 1

GOSUB 6

PRINT F

END

IF N > 1 THEN 8

RETURN

MULT F N

SUB N 1

GOSUB 6

RETURN

.


What to turn in:

Via Checkmate, turn in one Word or text document with your answers to part (a) and part (c).

For part (b), turn in via Checkmate all of your Java files, including the tester.


Written by David G. Kay, Winter 2003 to build on "What's Simple Is True," an ICS 22 lab by Alex Thornton.



David G. Kay, 406B Computer Science
University of California, Irvine
Irvine, CA 92697-3425 -- (949) 824-5072 -- Fax (949) 824-4056 -- Email kay@uci.edu

Monday, February 17, 2003 -- 8:07 PM