More functions for calculating relevant data, and completed prototype kernel.

Calculation of number of purchases made for each product, updating loyalties,
calculating profits and shifting pointers in the profit array to make it
possible to update each day's profits.
Some utility functions for file output.
and array printing.