Assignment III

Due date Wednesday March 20

The purpose of this assignment is to use the polynomial manipulation package in an interactive algebraic calculator. The calculator keeps a table of polynomials and allows the user to refer to them by name. The names are strings of characters and digits. The operations supported by the calculator are assignment, addition, multiplication, evaluation at a point, and display. The following syntax should be self-explanatory:

             read Poly1
             Poly2 = poly1
             Fourier = Poly2 * Poly1
             print Fourier
             value Fourier 2.0 3.0
For input use the format you chose for the previous assignment. Internally the calculator maintains a symbol table, to map names into the polynomials that they designate. This symbol table can be a simple association list, that is to say a list of pairs (string, polynomial). Optionally it can be a more efficient data structure, for example a tree or a hash-table, but this is not required at this point. The system is interactive, so it should diagnose an illegal name in an expression, i.e. an undeclared name. The argument of a Read instruction, and the left-hand side of an assignment, can introduce new names into the calculator.

The final version of this assignment should be done in C++. For those of you for whom C++ is brand-new, it's ok to submit first an Ada version, but the final submission must be in C++. You will find that most of the algorithmic aspects translate in a completely straightforward manner, so the only (small) challenge is to cast the framework of packages and private types into that of classes and header files.