supermarket code kata, from http://codekata.pragprog.com/2007/01/kata_nine_back_.html