The following warnings occurred:
Warning [2] count(): Parameter must be an array or an object that implements Countable - Line: 795 - File: showthread.php PHP 7.4.33 (FreeBSD)
File Line Function
/showthread.php 795 errorHandler->error





Post Reply 
Single User Defined Program Key Press to Answer.
07-06-2021, 09:39 PM (This post was last modified: 07-06-2021 09:40 PM by matalog.)
Post: #1
Single User Defined Program Key Press to Answer.
This little program, will take the last entry in the stack (in Algebraic mode anyway) and use it to display the subtotal, and amount of tax.

Code:
KEY K_Ln()
BEGIN
LOCAL G:=ROUND(Ans(1)/1.2,2);
LOCAL H:=ROUND(Ans(1)/6,2);
LOCAL I:={};
I(1):=G;
I(2):=H;
MSGBOX(I);
RETURN 46;
END;

It assumes the last number on the stack is the total including tax, and that you want, what the total would have been before tax, and the amount of tax. Pressing LN activates it.

Rather than teaching people how to calculate tax, it is an example of a program that works by a single keypress and displays a result.

Return 46; at the end of the program ensures that the program doesn't return anything to the stack, or the live calculator line. It basically presses the On button, which I assume to be harmless.

Any suggestions of a way to get the result to the stack would be very welcome!
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
Single User Defined Program Key Press to Answer. - matalog - 07-06-2021 09:39 PM



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