(15C) Cash Register
|
04-04-2018, 10:36 PM
(This post was last modified: 04-04-2018 10:51 PM by Michael Zinn.)
Post: #1
|
|||
|
|||
(15C) Cash Register
This is an implementation of a cash register. What's special about it is that it is optimized for convenient quick usage.
Setup 1. Put the current amount of cash in register 0 2. Put the price list in the other registers. 3. Run A (Abort) to make sure that the register is in initial state. Example register price list: 1 Fries $1.00 2 Extra Ketchup $0.20 3 Coke $0.80 4 Ice Cream $2.50 Usage 1. First, input what the customer wants to buy. E.g. if they say "2 Fries and 1 Coke" you enter 1 E E 3 E. Notice that you press the E button as many times as the preceeding item is to be sold. 2. Press D when Done. It will now show how much to charge the customer. Tell it to the customer. 3. Enter how much the customer is giving you and then hit C to calculate Change. E.g. if the customer is handing you $10 you'll enter 10 C. The calculator will now show you how much change to give with a negative sign (if it shows a positive sign it means that the customer didn't give you enough money). 4. If all is well hit B like Bye to commit the transaction or hit A like Abort to cancel everything. At the end of the day, you should check if you actually have as much money as there is in register 0. Program Notice that this uses program fall through so you'll have to enter B right before A or it won't work Code:
|
|||
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. 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 ...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 That's even one step shorter. With all suggestions implemented the program would look like this: Code: LBL E Dieter |
|||
04-05-2018, 03:35 PM
Post: #3
|
|||
|
|||
RE: (15C) Cash Register
Thanks for the feedback!
I think that the change should already be negative, given that you first enter the amount the customer hands over to you before starting C, which will subtract it. Using I and x<> is a good idea (The reason why I used .8 and not .9 is that I'll be using .9 for something else somewhere) |
|||
04-05-2018, 08:26 PM
Post: #4
|
|||
|
|||
RE: (15C) Cash Register | |||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 2 Guest(s)