I will explain this program in fragments.
A complete listing of the program is provided in Listing 6.