Until now this text has concentrated on the details of *how* to program using the Modula-2 notation. The present chapter does not represent a radical departure from that pattern for it is principally concerned with examples of such programs. However, it will attempt to consider some of the *why* and *what* questions, that is, the motivation for writing programs. For instance, there are some facilities that are not a part of the Modula-2 notation proper, but that must (frequently) be devised or imported by the programmer. Likewise, there are certain common classes of applications problems that arise frequently in real life, and some samples of these are worth a close examination.

Two groups of applications:

A. Strings

B. Mathematical, Scientific and Financial Applications

have been selected, not because these are the only important ones, but because all are frequently present in some way as part of many applications. These three also present problems whose solutions are both interesting in themselves and illustrative of a number of important programming methods and language constructions.

For instance, most applications make use of strings. The writer of useful programs must not only create the code that performs the task at hand, but must also generate the interface between that task and the person who will operate the program. This human/machine interface will necessarily involve writing and presenting numerous screens of information for that operator. This in turn will require that the programmer pay close attention to the handling of the text that constitutes that information. In addition, the data processed by a program is often in the form of strings, and so the manipulation of these as entities in themselves also takes on some importance.

More important than that, computers compute. Whether one takes the traditional view and regards mathematics as God's universal notation to express His design of the Universe, or whether one thinks of mathematics as purely the invention of the human kind and not dependent on any prior reality for its validity, it is the indispensable tool for describing our surroundings. Without the language of mathematics, there would not only be no computers or modern technology, there would be no science at all--no means by which to express questions about the Universe, much less to obtain answers to those questions. There is, after all, that within mathematics which cries out to be applied.

So, this portion of the chapter will offer a few illustrative examples from among the many possible that are largely mathematical in nature. These have a wide range of applications that often belies their apparently abstract nature. In this section the techniques to compute some statistical tools such as the mean, and standard deviation. Random number generators will also be examined.

One section is devoted to a specific kind of problem in physics, and the solutions to these too, as it will soon be evident, depend heavily on the underlying mathematical principles.

The last section is devoted to expanding upon and then encapsulating the many procedures needed to make the financial computations that were discussed in section 4.9.

The sections of the chapter (Part A) on strings is a single unit, but all the ones after that (Part B) are independent of it and of each other. This will allow hard-pressed instructors and students to pick and choose somewhat to suit their interests.