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
Post Reply 


Messages In This Thread
Cost/Price/Markup/Margin; 12CP - Zac Bruce - 08-20-2017 09:57 AM
RE: Cost/Price/Markup/Margin; 12CP - Gamo - 08-21-2017, 04:56 AM



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