CS509 - Software Engineering - Fall 96

Homework 2

A3 Calculator (25 points)

Description

Pointer Usage: Operations may be performed with pointer button 1, or in some cases, with the keyboard. Many common calculator operations have keyboard accelerators. To quit, press pointer button 3 on the AC key of the TI calculator.

Calculator Key Usage: The numbered keys, the +/- key, and the +, -, *, /, and = keys all do exactly what you would expect them to. It should be noted that the operators obey the standard rules of precedence. Thus, entering "3+4*5=" results in "23", not "35". The parentheses can be used to override this. For example, "(1+2+3)*(4+5+6)=" results in "6*15=90".

The action procedures associated with each function are given below:

     1/x       Replaces the number in the display with its reciprocal.

     x^2       Squares the number in the display.

     SQRT      Takes the square root of the number in the display.

     CE/C      When pressed once, clears the number in the display
               without clearing the state of the machine.  Allows
               you to re-enter a number if you make a mistake.
               Pressing it twice clears the state, also.

     AC        Clears the display, the state, and the memory.
               Pressing it with the third pointer button turns off
               the calculator, in that it exits the program.

     INV       Invert function.  See the individual function keys for
               details.

     sin       Computes the sine of the number in the display, as
               interpreted by the current DRG mode (see DRG, below).
               If inverted, it computes the arcsine.

     cos       Computes the cosine, or arccosine when inverted.

     tan       Computes the tangent, or arctangent when inverted.

     DRG       Changes the DRG mode, as indicated by 'DEG', 'RAD',
               or 'GRAD' at the bottom of the calculator ``liquid
               crystal'' display.  When in 'DEG' mode, numbers in
               the display are taken as being degrees.  In 'RAD'
               mode, numbers are in radians, and in 'GRAD' mode,
               numbers are in grads.  When inverted, the DRG key
               has a feature of converting degrees to radians to
               grads and vice- versa.  Example: put the calculator
               into 'DEG' mode, and enter "45 INV DRG".  The
               display should now show something along the lines
               of ".785398", which is 45 degrees converted to
               radians.

     e         The constant 'e'.  (2.7182818...).

     EE        Used for entering exponential numbers.  For example, to 
               get "-2.3E-4" you'd enter "2 . 3 +/- EE 4 +/-".

     log       Calculates the log (base 10) of the number in the
               display.  When inverted, it raises "10.0" to the
               number in the display.  For example, entering "3
               INV log" should result in "1000".

     ln        Calculates the log (base e) of the number in the
               display.  For example, entering "e ln" should
               result in "1".

     y^x       Raises the number on the left to the power of the
               number on the right.  For example "2 y^x 3 ="
               results in "8", which is 2^3.  For a further
               example, "(1+2+3) y^x (1+2) =" equals "6 y^x 3"
               which equals "216".

     PI        The constant 'pi'.  (3.1415927....)

     x!        Computes the factorial of the number in the
               display.  The number in the display must be an
               integer in the range 0-500, though, depending on
               your math library, it might overflow long before
               that.

     (         Left parenthesis.

     )         Right parenthesis.

     /         Division.

     *         Multiplication.

     -         Subtraction.

     +         Addition.

     =         Perform calculation.

     STO       Copies the number in the display to the memory location.

     RCL       Copies the number from the memory location to the display.

     SUM       Adds the number in the display to the number in the memory
               location.

     EXC       Swaps the number in the display with the number in the
               memory location.

     +/-       Negate; change sign.

     .         Decimal point.
accelerators Accelerators are shortcuts for entering commands. xcalc provides some sample keyboard accelerators; also users can customize accelerators. The numeric keypad accelerators provided by xcalc should be intuitively correct (i.e., pressing "1" on the keyboard is like clicking the "1" button on the calculator).

Turn In

This assignment covers Object-Oriented Analysis, Design, and Testing.

Following Section 19.4.4, one can track the progress of an Object-Oriented Project by a set of technical milestones. Each of these phases will result in a document to turn in.

  1. OO Analysis
  2. OO Design
  3. OO Testing
heineman@cs.wpi.edu; Mon Nov 11 10:21:37 1996