
Developing
an
algorithm
(iii) Check expected results match actual results
Yes,
the expected result for each set of data matches the calculated
result.
The desk checking of this example has illustrated a number of
points. Firstly, algorithms containing a series of mathematical
calculations must be checked thoroughly on paper before the
commencement of program coding. Secondly, the algorithm could be
improved, to ensure that no further testing of the coin denominations
is performed once the change reaches zero. This improvement could
easily be added to the algorithm in pseudocode, as will be illustrated
in the next chapter.
3.4
Chapter summar ...