Program Hints

Keep in mind, files can be text or binary. You can read and write numbers directly from a binary file. With a text file, you'll read or write strings. Strings will need to be converted to numbers before you can do any calculations, and numbers will need to be converted to strings before you write them to a file. Be careful to be consistent and not mix numbers and strings in a file.

In calculating the median and mode, first sort the data. You need to do that anyway.

Remember that the median is the middle number only if you have an odd number of values. It is the average of the two "middle" numbers if you have an even number of values.

To calculate the mode, select the first value in the list as a "possible mode" with a "count" of one. Then sweep through the data counting how many times each item occurs. Whenever you find an item that occurs more than "count" times, it becomes the new "possible mode" and the number of times it occurs becomes the new "count". When you have processed all the data the "possible mode" is the mode and the "count" is the number of times it occurs.

Finally, don't forget to check your code for documentation, appropriate use of subroutines, etc.

Recursion

A function that calls itself is recursive.
Expressive but a danger of infinite loops.

Three Laws of Recursion:
1. Must have non-recursive base-case
2. Must test for base-case before recursive call
3. Recursive call must be "simpler", i.e., must "move toward" the base-case

examples