Code for assignment 11a.
Done in a very nice coding session.