CMPT 212                      Assignment 3
Spring 1998                   ------------


Due date:  1:30pm, Friday, March 20, 1998
           in the assignment drop-off boxes.
	   LATE ASSIGNMENTS WILL NOT BE ACCEPTED.


1. Goal

   - To become familiar with class inheritance, abstract classes,
       and virtual functions.

2. Overview

   - The program will be a program to read, parse, display, and
       evaluate two arithmetic expressions.

3. Description

   - From a user's perspective, the program will appear to be
       identical to the program from Assignment 2.

4. Design of the Program

   4.1 Modules
      - The program will consist of three modules: a "Parse" module,
          a "Expression" module, and "Main" module.

   4.2 The Parse Module
      - This module defines the data types and functions to
          parse a character string into an expression.
      - The source files for this module will be called "parse.h" and
          "parse.cpp".

   4.2 The Expression Module
      - This module defines the "expr", "constant", and "composite"
           classes.
      - The source files for this module will be called "expr.h" and
          "expr.cpp".

   4.4 The Main Module
      - The source file for this module will be called "asgn3.cpp".
      - This module contains the main function of the program.

5. Design Features

   5.1 Error Checking
      - Very little error checking needs to be done.
      - The program does not have to check for out-of-memory errors
          or input errors.

   5.2 Given Code
      - The following files are given to you.  You must use them.
          You must not change them.
               parse.h
               expr.h
      - You must implement all of the functions defined in "parse.h"
          and "expr.h".
      - These files will be available on the class web page and also
          in the Assignment Lab on the N: drive.

   5.3 Classes
      - The "expr" class is an abstract class which models an
          expression.
      - The "constant" class is a class derived from "expr" which
          models a constant expression.  A constant expression is
          an expression which consists of just a number (no
          operations).
      - The "composite" class is a class derived from "expr" which
          models an expression that contains an operation.

   5.4 Bool Type
      - If you are using a compiler which does not support the "bool"
          type, you must define the "bool" type yourself in a header
          file called "bool.h".  Your program must be able to compile
          without errors under the Borland C++ in the Assignment Lab.

   5.5 Miscellaneous
      - Use "const" wherever possible.
      - Use the smallest scope and lifetime for every variable,
          constant, and function.

6. Source Code Comments
   - Your source code must be fully commented.
   - See the Sample Assignment on the web page for an example of
       the expected commenting style.
         http://www.cs.sfu.ca/CC/212/simpson/98-1/assignments/sample.html

7. Test Runs
   - Run your program with this input:
       - Display the first expression.
       - Set the first expression to "10-3*2".
       - Display the first expression.
       - Evaluate the first expression.
       - Set the second expression to "4.2*(2-5)".
       - Display the second expression.
       - Evaluate the second expression.
       - Join the expressions using division.
       - Display the first expression.
       - Evaluate the first expression.
       - Clear the second expression.
       - Display the first expression.
       - Evaluate the first expression.
       - Display the second expression.
       - Evaluate the second expression.
       - Quit.

8. What to Hand In
   - Title page containing:
        a. Course number
        b. Assignment number
        c. Student name
        d. Student number
        e. Student email address
   - Listing of the source code in this order:
        a. asgn3.cpp
        b. parse.h
        c. parse.cpp
        d. expr.h
        e. expr.cpp
        f. bool.h  (if written -- see Section 5.5 above)
   - Scripts of the test run (see Section 7 above).

(end of assignment)