16-02-2013, 04:33 PM
Calculator
Calculator.docx (Size: 139.96 KB / Downloads: 33)
Scope
This document specifies the functional requirements for a multi-function calculator program. The program is designed to act like a handheld calculator, with the usual standard functions (add, subtract, multiply, divide , logarithm and exponentiation). The calculator will also be able to compute the power, sine, cosine, tangent, exponential, logarithm, natural logarithm, square root functions, power, factorial, square, cube, and there Hyperbolic functions. The program is designed to be as easy to use as a regular calculator.
Environment and Interface Requirements
This section describes the external influences imposed on the calculator program.
Hardware and Software
The program shall be written in standard C, as compiled by the TURBO C compiler (). The program shall use only standard C library functions. The program shall be usable on any system which supports the compiler, and shall not require any particular hardware or software.
External Data Bases and File Interfaces
There are no existing external data bases or files that will be needed by this program.
Human Interfaces
The program shall operate as much as possible in the same way as a regular handheld calculator, such that anyone familiar with the operation of such a device should have little trouble using the program. The user can then type a sequence of numbers and operators, similar to a regular calculator. The program will display the calculated answer to the entered problem on the line following the input line.
Calculate
This function will accept correct input from the input function and will perform the arithmetic operations requested by the input. The five arithmetic functions are listed above. The following specifications apply:
1. Exponentiation can be restricted to whole-number powers. If a number with a fractional part is input as an exponent, the program should use the nearest whole number power (i.e., rounded), and then print a message to inform the user of the variation.
2. Division by zero should be detected by the program, and an error message should be Printed.
3. Overflow and underflow do NOT need to be detected.
4. The order of calculation need only proceed from left to right; it is not necessary (or recommended!) that any hierarchy be placed on the order of calculations.
General Design Guidelines
The following are general guidelines associated with the calculator program:
1. The program should be .bomb-proof.. With the exception of overflow and underflow, no user input should cause the program to terminate abnormally.
2. This specification details minimum requirements for the program. As long as these requirements are met, any additional features or functions, or other operational enhancements, may be added.
3. The source language to be used is standard C. Any non-standard or system-dependent features shall be avoided if at all possible.