(HP67 app) Pricing Calculation with known Markup for new Price comparison.
|
10-19-2017, 08:03 PM
(This post was last modified: 10-19-2017 08:42 PM by Dieter.)
Post: #2
|
|||
|
|||
RE: (HP67 app) Pricing Calculation with known Markup for new Price comparison.
(10-16-2017 01:38 PM)Gamo Wrote: I still can't find the way to do this pricing calculation method just by press the two known variables and get the answer for the other two variables. That's not trivial, for several reasons. For instance there are multiple ways to calculate each of the four variables, depending on which ones are known are which are not. Then there are cases where no unique solution exists (e.g. if only markup and margin are given). Here is a program that does what you want. Enter any two of the four variables, and the other two are calculated. The program uses a method that I already implemented more than 30 years ago for a triangle solver (enter any three... you get the picture). If a variable is entered, a constant of 1 (cost), 2 (price), 4 (markup) or 8 (margin) is added to R0. This way each of the six possible cases produces a unique sum: cost & price => 3 cost & markup => 5 price & markup => 6 cost & margin => 9 price & margin => 10 markup & margin => 12 The last case can be neglected since no unique solution for cost and price exists if only markup and margin are given. Now the program can simply jump to the label with that number to start the calculation. Actually it jumps to a label with that number minus 3 because this way all results are between 0 and 9 and the labels above (LBL A = #10) can be used without interfering with the calculation routines. Pressing [E] initializes the program. After two values have been entered (counted by a DSZ command) the calculation routine at LBL e starts. LBL a and b hold some calculations that appear several times. Afterwards pressing one of the keys [A]...[D] shows the respective result. Here is the listing: Code: 001 LBL E Here is an example: Code: Initialize [E] 0,00 All data can now be recalled by pressing the [A] to [D] keys. Be sure to press none of the number entry keys because else this will be considered a new data input. Code: Get cost [A] 110,00 Another example: Code: Initialize [E] 0,00 You can also try any other combination. Including markup & margin. Try it: it will result in an "Error" message. Note: data entry is detected by flag 3 which, on the '67 and '97, is set if you enter data with the number entry keys. It is not set if you recall a value from a register. So if you want to do so press any number key before. If you want you can change this to another method, e.g. consider only non-zero values as data entry. In this case simply replace the double F3? tests (which behaves like a FC?C 03) by an "X=0?" test. Dieter |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 1 Guest(s)