Any examples of online store + shopping-cart classes?

From: Lisa Kim (lisa.kim_at_stanford.edu)
Date: 01/10/04


Date: Sat, 10 Jan 2004 21:08:01 GMT

I'm just starting to learn OOP. I'm finally starting to "get it", which is
a wonderful feeling.

But now that I've seen examples of ATMs, cars, blackjack games, I'm want to
try making a UML for something tougher, that's got me stuck.

I know there must be examples of classes for an online store out there, but
I can't find any.

In particular what I'm stuck on are the "items" class, because stores like
Amazon have created interesting non-physical-world situations like this:

SITUATION: an item is in your cart, but if you buy it at the same time as
another item, the price on each of them is discounted.
EXAMPLE: "Each Harry Potter book is $20. But buy any two of them and
they're $18 each. Buy all five, and they're $15 each."

What object would be responsible for making that happen?

The "book" object, for knowing what combinations of things it's mixed with
would lower its price?

The "cart" object, for knowing all combinations of things that might be
discounted?

I'd like to think it's like a "storeOwner" object : the man with the
moustache that decides these kinds of things. But hey that'd be a God
Object and that's not wise. :-)

Any suggestions appreciated. Thanks!



Relevant Pages

  • Re: Zimbabwe introduces 100-billion-dollar note
    ... it was easy to find, and while it was "unc", the price ... He showed me some, but again, not knowing what I was evening ... I only found some "lower denomination" bills for sale from Zimbabwe. ...
    (rec.collecting.coins)
  • Re: prevent google cache?
    ... >>ordering always with actual price, ... > but may be happening with your cart. ... > Save off a page from your site (or use the original html files on your ... I use a popular shopping cart where the 'buy button' is a small html form ...
    (alt.internet.search-engines)
  • Re: At the BORG - What Would You Do?
    ... When the clerk scanned the cart, I guess she only scanned the plywood, even though the other stuff was in plain view. ... I still argue with other small business owners when I feel like a price is /too/ low, because I really want 'em to still be there to do business with the next time. ... A number of years ago I bought some metal shelving brackets for something like $3.00 or so each. ... I decided that I didn't need brackets as long as I had bought so I took them back to exchange for shorter ones. ...
    (rec.woodworking)
  • Re: [PHP] how to determine if shopping cart has been abandoned?
    ... this makes problems when you're adding promotional product to ... the cart, which should have a seperate price. ... > removed form the shopping cart when the user reconnects. ...
    (php.general)
  • Re: Consciousness
    ... but the price we pay for that better life is high. ... it is the price of knowing what pleasure is and knowing ... >> I believe that animals may have a bit of this kind of consciousness. ...
    (talk.religion.buddhism)