[Pharo-users] [ANN (Toy)]: Gold Rush
Sean P. DeNigris
sean at clipperadams.com
Mon Feb 16 21:41:47 EST 2015
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:
smalltalkhubUser: 'SeanDeNigris' project: 'SeansPlayground';
(#GoldRushSpecification asClass>>#testAcceptance) browse.
"You can describe a piece of jewelry like:"
| ring |
ring := GoldJewelry new
weight: 4.1 grams;
price: 275 dollars;
"And then see how much of a premium you're paying over the gold's melt value
ring markup should equal: ring price - expectedGoldValue.
ring percentOverSpot percent should equal: ring price / expectedGoldValue -
"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.
View this message in context: http://forum.world.st/ANN-Toy-Gold-Rush-tp4806070.html
Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.
More information about the Pharo-users