Having suffered at the hands of "let's buy a reference table package because we don't have to build the code ourselves (i.e., do it right with normalized tables)", may I...
Many thanks to Steve for providing the basics and for tymberwyld mentioning the "Special Cases".
It took somewhat longer than half an hour but for about four hours of...