Assignment 3: Evolution

Part A: Quote of the Day Version 2

Add the following features to your existing Quote of the Day application (start with your existing code, and add to it):

Quotes should be stored in an external file, and read in on startup, so that people can add to the set of quotes by editing the file.

Users can get more than one quote in a session, and don't get a repeat of the same quote in the same session, unless they exhaust the total number of quotes available, in which case they may repeat.

Part B: Spreadsheet, Phase 2

This phase adds formula capability to the basic spreadsheet engine. Formulas are strings of symbols which can be interpreted as a mathematical expression involving constants and cell references.

To make parsing simple, we'll use prefix notation for the expressions. In prefix notation, the operator comes first, then any arguments. So the expression "+ A1 A2" is the same as the more common expression "A1 + A2".

Your formulas should support +, -, *, and /. They should also allow grouping with parenthesis -- "()". Here are some examples:

+ A1 1 -- Adds 1 to the value of cell A1

*(+ A2 5) B7 -- Adds 5 to A2, then multiplies the result by the value of B7

In addition to a double number or a string, a cell can now contain a formula. When a cell containing a formula is displayed, it displays the result of the formula rather than the formula itself. So if a cell contains the formula (+ 1 1) it would display the value "2". If a formula is invalid (for example, it has syntax errors, or attempts to add a string to a number) its display is the string "ERROR".

Circular references are not allowed, and display the string "ERROR" if they are attempted. (For example, if you put the formula "A1+1" in cell A1, A1 would display "ERROR").

Deliverables

Class diagram, Java code, and output of one or more test runs.