This standalone application is a mathematical calculator that supports
multiple number bases (binary, decimal, hexadecimal) and formats (fixed
point, floating point, rational). The application converts operands and
from the current base and format upon user requests.
Focus: this case study exemplifies the use of UML interaction diagrams
and use cases to describe the exchange of messages among objects
representing different bases and formats.
OO techniques: inheritance and polymorphism.
Java features: exception handling.
Background: the reader is required to know the basic OO techniques,
which are exemplified in previous chapters.
In an educational setting the capability of switching from one type of repre-
sentation of numbers to another is important. When making calculations on
paper it is common to use a wide range of notations. On the other hand,
common electronic calculators possess only limited capability in this respect.
In particular, a number representation format that is often neglected in
calculators is the fractional format, used to represent rational numbers.
What is required is a calculator that is able to manipulate rational numbers
in their fractional format.
Such a calculator can be used as a teaching tool to help understand the
relationship between different notations. In particular the calculator should
handle the following representation formats:
The number base represents another important issue. The most common
base used by people is the decimal base, but in the digital era two other bases
play an important role: binary and hexadecimal. Therefore the calculator
must handle the following bases: