The Five Steps
Write an algorithm for solving the problem
This program is one of moderately significant size, and
the only way to even hope to get it working is to
take a systematic, modular approach to its implementation.
For this homework, I will do the partioning into modules for you
to show you how it is done.
(Later in the course will you be required to perform
this type of design on your own).
The development steps you will go through below are the same
that I used when writing the sample.
In this section I describe the partioning I choose to approach
this task.
This is by no means the only partioning possible, but is a reasonable
one.
Looking at the
specification
for the calculator,
it appears we will need to do things like:
-
get operands and operators from the input,
-
compute the values of expressions, and
-
display things in the "larger-than-life" format.
So, I will divide the task into five subtasks or modules,
-
the
Operands Module,
-
the
Operators Module,
-
the
Results Module,
-
and
the
Display Module.
-
Of course, we will also need a
Driver Module
-
as the "glue" that binds
this whole thing together.
(In fact, we will be writing several driver modules as we
ncrementally implement each module
and test them).
Here is the structure diagram for the entire project:
Test the program
to Overview.