Post Reply 
Cost/Price/Markup/Margin; 12CP
08-20-2017, 09:57 AM (This post was last modified: 08-20-2017 10:32 AM by Zac Bruce.)
Post: #1
Cost/Price/Markup/Margin; 12CP
Hi all, in response to Gamo's question in another thread r.e. creating a program to run on the 12c Platinum to calculate Cost/Price/Markup/Margin, I had a go at creating something. I'm pretty inexperienced so if anyone would take the time to look at the program and make suggestions for improvements it would be greatly appreciated.

Also I realise that the calculations themselves are fairly trivial; doing the calculations manually is easy enough to not need a program, but I used this as an exercise in learning to program the calculator.

The following registers are used to either store the know information, or to RCL the unknown variables after the program has run.
1= Cost
2= Price
3= Markup
4= Margin

Code:

001- RCL 1
002- x=0?
003- GTO 039
004- RCL 2
005- x=0?
006- GTO 016
007- Triangle % (percentage change, I don't know how to do a triangle!)
008- STO 3
009- R down (R down arrow; roll stack)
010- RCL 2 
011- x><y
012- Triangle %
013- CHS
014- STO 4
015- GTO 000
016- RCL 3
017- x=0?
018- GTO 026
019- RCL 1
020- x><y
021- %
022- +
023- STO 2
024- RCL 1
025- GTO 012
026- RCL 4
027- ENTER
028- ENTER
029- 1
030- x><y
031- %
032- -
033- /
034- STO 3
035- RCL 1
036- x><y
037- %
038- GTO 022
039- RCL 2
040- RCL 3
041- x=0?
042- GTO 057
043- ENTER
044- ENTER
045- 1
046- x><y
047- %
048- +
049- /
050- STO 4
051- RCL 2
052- x><y
053- %
054- -
055- STO 1
056- GTO 000
057- RCL 2
058- RCL 4
059- %
060- -
061- STO 1
062- GTO 001

Can P/R be used in place of GTO 000 to end the program?
I'm sure also that there is some functions repeated in there that I could have cut out. I cut out a few repeated sections by looping back, but I'm sure there is more I could have done. I think if I was to do this on my old 12C it would actually make the program slower; because it recalculates values that are already there. Probably not a big problem here with a short, simple program, but something for me to think about in the future.

Also working through the program I wasn't always aware of the stack and what was in there, so I used RCL a lot rather than trying to remember where numbers were in the stack. I guess if a number is already stored in a register it saves steps to RCL rather than roll the stack, if you need to roll more than once.

Thanks to anyone that takes the time to have a look through and make suggestions.


Regards,

Zac
Find all posts by this user
Quote this message in a reply
08-21-2017, 04:56 AM
Post: #2
RE: Cost/Price/Markup/Margin; 12CP
Hello Zac

Thank You for your time to try this out. I try your program and don't know how to execute the value sine you didn't give example yet.

I was thinking is it better if program on HP 15C since it got 5 labels A, B, C, D and E that can be use like LBL A for Price, LBL B for Cost, LBL C for Margin and LBL D for Markup.

Gamo
Find all posts by this user
Quote this message in a reply
08-21-2017, 05:28 AM
Post: #3
RE: Cost/Price/Markup/Margin; 12CP
(08-21-2017 04:56 AM)Gamo Wrote:  Hello Zac

Thank You for your time to try this out. I try your program and don't know how to execute the value sine you didn't give example yet.

I was thinking is it better if program on HP 15C since it got 5 labels A, B, C, D and E that can be use like LBL A for Price, LBL B for Cost, LBL C for Margin and LBL D for Markup.

Gamo

Gamo,

Sorry I should have made it more clear: you store your known values in the registers mentioned e.g. cost= 140000 STO 1, Price= 200000 STO 2, then run the program. It will then store the markup/margin in registers 3 and 4 respectively, which you can RCL to see. E.g. RCL 4 = 30.00 (margin) RCL 3 = 42.86 (Markup)

I discovered a problem today in that it will convert markup to margin with no cost/price values entered (I.e. registers 1 and 2 = 0), but it loops endlessly if trying to convert from margin to markup with no cost/price values. It's easy to fix, but it will add more program steps, I think. You can work around it by storing any value in to registers 1 or 2. I think I will rework the entire program to eliminate any repeated steps and to allow it to calculate markup from margin with no other values.

I think you're right in that if you could put labels and have the program pause for inputs it would be much more useful. I don't have a 15C to be able to experiment. I think using the Solver on any of the models that have it would also be a very good solution. I haven't played with the solver much but I have a 17B and also a 35s, so it might be a good reason for me to have a look at those.


Thanks,

Zac
Find all posts by this user
Quote this message in a reply
08-21-2017, 07:10 AM (This post was last modified: 08-21-2017 08:47 AM by Dieter.)
Post: #4
RE: Cost/Price/Markup/Margin; 12CP
(08-20-2017 09:57 AM)Zac Bruce Wrote:  The following registers are used to either store the know information, or to RCL the unknown variables after the program has run.
1= Cost
2= Price
3= Markup
4= Margin

For a more convenient functionality the user could enter a code 1...4 along with the value and the program either stores the value (if > 0) or calculates it (if = 0):

1 [ENTER] 200 [R/S] => store cost = 200
1 [ENTER]   0  [R/S] => calculate cost

I have been thinking about this idea, but on the 12C this requires some effort.

Code:
007- Triangle % (percentage change, I don't know how to do a triangle!)

This triangle is a capital Greek Delta, the mathematical symbol for a difference: Δ% is the difference in percent ("delta percent"). Greek characters are part of many character sets, take a look at the respective character map (e.g. in Windows execute "charmap"). Or simply copy this Δ here. ;-)

(08-20-2017 09:57 AM)Zac Bruce Wrote:  Can P/R be used in place of GTO 000 to end the program?

?!? – P/R is not programmable.

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




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