07-06-2021, 09:39 PM
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.
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!
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!