extensive pseudo code for jQuery cash register
more pseudo code for step 2