This assignment is due on Friday, January 31.

(a) If you don't have much experience coding dynamically allocated, linked structures, you might want to postpone this part of the assignment until after Tuesday's lecture, proceeding straight on to part (b) now.

In the Goodrich and Tamassia book, you should look closely at problems R-4.1 through R-4.7 and know how to do them. We're not going to ask you to write down and turn in the answers, but do be sure you know what's going on here; something similar might show up on an exam.

Likewise, you should understand the concepts behind P-4.3 through P-4.7. Again, we aren't asking you to turn anything in for this (so you can spend your time on the rest of this assignment) and for now we're not expecting you to be able to do these perfectly from memory, but you should understand the concepts and be able to apply them given some hints, reference points, or context.

(b) Look at Alex Thornton's Project #3 from ICS 22, available on the web at .

(b.1) Code the problem as specified. First, download the file that contains the skeleton of the program; the Java files for the classes you will write (MenuItem, Menu, Order, Table, and Restaurant) contain good advice and detailed specifications of the methods you'll need to code.

(b.2) Here are a few questions about this problem and its implementation. Answer them briefly in a Word (or plain text) document:

  1. The Menu and Order classes allow you to assume that they will never contain more than 1000 items. Why? What would you have to do differently if you weren't allowed to make those assumptions?

  2. What parts of your program (which fields and methods in which classes) would have to change if restaurants were allowed to add and remove tables (dynamically, during the time they're serving)?

  3. There are three multiple-valued structures in this program: the collection of Tables in the Restaurant, the collection of MenuItems in an order, and the collection of MenuItems on the Restaurant's Menu. Probably you implemented all of them as unordered arrays. Which one of them is the best candidate to be implemented in one of the other multiple-valued structures we have discussed (ordered array, linked list, binary search tree, hash table)? Which alternative would you choose, and why? (There may be no single, obvious, compelling answer to this. Just think of how the restaurant's business might change over time, or how the technology used might change, and think about which re-implementation might plausibly provide the greatest benefit.)

  4. (extra credit) What's the pun behind Chez Quis, the name of the restaurant in Alex's example? Can you come up with a funnier one?

What to turn in:

For part (b), turn in via Checkmate:

Written by David G. Kay, Winter 2003 to build on "Scenes from an Italian Restaurant," 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

Friday, January 24, 2003 -- 4:48 PM