[ANN (Toy)]: Gold Rush

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

[ANN (Toy)]: Gold Rush

Sean P. DeNigris
Administrator
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
Reply | Threaded
Open this post in threaded view
|

Re: [ANN (Toy)]: Gold Rush

Ben Coman
Should that be.... ?

"You can describe a piece of jewelry like:"
        | ring |
        ring := GoldJewelry new
                weight: 4.1 grams;
                carats: 18;
                price: 275 dollars;
                pinch yourself.

On Tue, Feb 17, 2015 at 10:41 AM, Sean P. DeNigris <[hidden email]> wrote:
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
--
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.


Reply | Threaded
Open this post in threaded view
|

Re: [ANN (Toy)]: Gold Rush

Sean P. DeNigris
Administrator
Ben Coman wrote
Should that be.... ?
...                pinch yourself.
;-p
Cheers,
Sean