Вы находитесь на странице: 1из 4

Four Function Calculator Requirement Specification

1. Introduction
This document describes the behavior of a simple four-function calculator application
intended for use on both Windows and Macintosh personal computers. The application
will model the behavior of a standard four-function pocket calculator as closely as possible.

2. Environment characteristics
2.1. Hardware
The application should run on both IBM-compatible and Macintosh hardware.

2.2. Operating System


While no information about particular operating systems was provided by the client, we
assume that the application should run on the most recent end-user versions of the primary
operating systems for each hardware platform. For the IBM-compatible system, this is
Windows 98. For the Macintosh, this is MacOS 8.5.

2.3. User expertise


The client is an experienced computer user. We therefore assume that users will have basic
knowledge of using the mouse and keyboard, along with the typical text editing conventions for the two platforms mentioned in section 2.2

3. Input/Output and System Modes


3.1. Data input
We assume that data input will occur only via the keyboard and the mouse. Entry of a
numeric quantity via either of these methods is terminated by clicking a button representing an operation.

3.2. Data output


3.2.1. Output display
All output will appear in a text display area similar to a calculators LCD screen.
3.2.2. Output events
Clicking a button representing an operation causes the display area to be updated. Results
will be presented to at most ten decimal places accuracy.

Four Function Calculator Requirement Specification

3.2.3. Exporting output data


The data in the display area may be selected and copied for pasting into other applications.

4. Software functions
4.1. Number entry
The application will present a visual keypad where one digit at a time can be added to the
display by using the mouse to select one of the digit buttons. An optional negative sign can
be entered before any digits have been entered; thereafter, the negative button will be
ignored. As long as an operation has not been requested, digits will be added to the righthand side of the current number. This number will be displayed in the display area as it is
composed. Number entry restarts after any arithmetic operation, result display, value storage, or clear operation is requested.

4.2. Number formatting


Numbers will be displayed to ten digits accuracy. They may include a decimal point
(which is not counted against the ten digits) and an optional leading negative sign.

4.3. Arithmetic Operations


Operations are represented by buttons on the calculator which specify the arithmetic operation to perform or the storage of a value for future recall. In general, the entry of a number is terminated by clicking on one of the operation buttons.
4.3.1. Addition
Clicking on the addition button, which will be marked with the character +, will cause
the current contents of the display area to be remembered, and will allow the entry of the
next number to begin.
4.3.2. Subtraction
Clicking on the subtraction button, which will be marked with the character -, will cause
the current contents of the display area to be remembered, and will allow the entry of the
next number to begin.
4.3.3. Multiplication
Clicking on the multiplication button, which will be marked with the character *, will
cause the current contents of the display area to be remembered, and will allow the entry
of the next number to begin.
4.3.4. Division
Clicking on the addition button, which will be marked with the character /, will cause
the current contents of the display area to be remembered, and will allow the entry of the
next number to begin.

Four Function Calculator Requirement Specification

4.4. Display result


The display result operation is requested by clicking on the = key. If a value has been
remembered by requesting one of the arithmetic operations, then the remembered value
is combined according to the requested operation with the value currently in the display.
The display is updated with the new value, and the calculator is made ready for the entry
of the next number.

4.5. Value memory


The calculator will allow one value to be stored for later recall.
4.5.1. Store value
A value is stored in memory by clicking on the button labelled Store. This causes the
value that is currently displayed to be copied to the storage location. This resets number
entry, so any digits that are subsequently typed will erase the displayed value.
4.5.2. Recall value
If a value is currently stored in the storage location, clicking on the Recall button will
replace the displayed value with a copy of the value from the storage location. This action
resets number entry, so any digits that are subsequently typed will erase the displayed
value.

4.6. Clear
Clicking on the Clear button erases any value that appears in the display area and resets
number entry. Clear does not affect the remembered value or the operation that has been
requested.

4.7. Data export


The application should allow the value in the display to be selected and copied for pasting
into other applications. It will not support values being pasted into the display.

5. Constraints and goals


5.1. Portability
The application should be implemented in such a way that it can be used from either an
IBM-compatible or Macintosh personal computer.

5.2. Usability
The interface of the calculator should be as close to the appearance and operation of a
physical calculator as possible. The appearance of the application on the two platforms
should be a close to identical as possible.

Four Function Calculator Requirement Specification

6. Response to undesired events


6.1. Division by zero
If the user requests division by zero, the application should put the message ERROR in
the display area and reset number entry.

6.2. Invalid value imported by pasting


If the user pastes a value into the display area which is longer than ten digits plus an
optional negative sign and decimal point, or if the user pastes a value which contains characters which are not digits into the display area, the calculator should display the message
ERROR and reset number entry.

7. Life cyle considerations


7.1. Subsets
1.

Basic calculation - entering two numbers and calculating a result. The Clear button should also work in this subset.

2.

Store and recall - in addition to the basic calculation functions, allow storage and
recall of one value.

3.

Accept pasted values - in addition to the basic calculation functions, allow a value
copied from another application to be pasted into the display area.
Note that subsets 2 and 3 are essentially independent and could be implemented in either
order.

7.2. Fundamental assumptions


None.

7.3. Potential Changes


1.

Other functions may be added.

2.

The number of digits displayed may be expanded.

3.

Other display formats, such as scientific notation, may be added.

4.

Copying of results for pasting into other applications may be added.

5.

The number of stored values may be expanded.

6.

The visual appearance of the calculator may be updated.

Four Function Calculator Requirement Specification

Вам также может понравиться