Post Reply 
(15C) Cash Register
04-05-2018, 07:31 AM (This post was last modified: 04-05-2018 08:28 PM by Dieter.)
Post: #2
RE: (15C) Cash Register
(04-04-2018 10:36 PM)michaelzinn Wrote:  This is an implementation of a cash register. What's special about it is that it is optimized for convenient quick usage.
...
Notice that this uses program fall through so you'll have to enter B right before A or it won't work

I do not see any problem here. If you press B there is no need to have it followed by A since this already has been executed.
Or maybe I did not understand you correctly. Did you mean that in the program LBL B has to be followed by LBL A? That's the way it is shown in the listing, and of course the user may not rearrange the program the way he likes to. ;-)

Maybe you should note that the price list is stored in register 1 through .7

The "calculate change" routine at LBL C may cause problems since it expects that the amount to pay (R.8) is still in Y.
I would recommend you replace this routine with...

Code:
LBL C
RCL .8
X<>Y
-
RTN

...so that this problem cannot occur. Personally, I would even remove the X<>Y so that the displayed change is negative, which shows that this it money paid out.

For your convenience you may also add a FIX 2 after LBL A.

BTW, the program is so short that all registers are available, so why not use R.9 instead of R.8? That's room for one more item on the price list. ;-)
You can even do it completely without R.8 or R.9, just replace all references to these with the I-register and change LBL E this way:

Code:
LBL E
X<> I
RCL+(i)
X<> I
RTN

That's even one step shorter.

With all suggestions implemented the program would look like this:

Code:
LBL E
X<> I
RCL+(i)
X<> I
RTN

LBL D
RCL I
RTN

LBL C
RCL- I
CHS    (Edit: added this line to display the change with negative sign)
RTN

LBL B
RCL I
STO+0

LBL A
FIX 2
CLX
STO I
RTN

Dieter
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
(15C) Cash Register - Michael Zinn - 04-04-2018, 10:36 PM
RE: (15C) Cash Register - Dieter - 04-05-2018 07:31 AM
RE: (15C) Cash Register - Michael Zinn - 04-05-2018, 03:35 PM
RE: (15C) Cash Register - Dieter - 04-05-2018, 08:26 PM



User(s) browsing this thread: 1 Guest(s)