I was in a jewelry store, and I realized how hard it is to figure out the markup on gold jewelry, so I did a little code kata...
Loads in 4.0 with:
Gofer it
smalltalkhubUser: 'SeanDeNigris' project: 'SeansPlayground';
configurationOf: 'GoldRush';
loadDevelopment.
(#GoldRushSpecification asClass>>#testAcceptance) browse.
"You can describe a piece of jewelry like:"
| ring |
ring := GoldJewelry new
weight: 4.1 grams;
carats: 18;
price: 275 dollars;
yourself.
"And then see how much of a premium you're paying over the gold's melt value e.g.:"
ring markup should equal: ring price - expectedGoldValue.
ring percentOverSpot percent should equal: ring price / expectedGoldValue - 1.
"If you inspect a GoldJewelry with GT Tools, you will see a special "Gold" tab with the same calculated values (i.e. #markup and #percentOverSpot)"
____________________________________
This was an interesting and fun test of Aconcagua, GT Tools, and Pharo 4.0 :)
n.b. it pulls the gold spot price off the web, updating daily.
Have fun!
Cheers,
Sean