Homework Assignment 2

A Simple Auction Program


810:062
Computer Science II
Object-Oriented Programming


Due: Tuesday, February 1, at 8:00 AM


Introduction

For this assignment, you will implement two small classes that work together to implement the beginnings of an auction system. We will extend this program a couple of times throughout the semester as we learn more about Java and object-oriented programming.

Programming Advice

Write your program in the style we first learned in Session 1:

Take small steps, and your tests will give you feedback as soon as possible. Use the GenerateTest program distributed with Session 1 to create your test class.


Auctions and Allocation Strategies

Consider the problem that faced Google last year. They wanted to sell a large number of shares of stock to new investors in the company. Many potential investors were willing to make a bid for shares. Each bid would consist of some number of shares at some offer price. Different bidders would offer different prices, and together they would request so many shares that Google would not be able to satisfy them all.

This is a general problem often solved with an auction.

For example, suppose that I have 100 books to sell. I might receive two bids, one for 70 books at $20 per book and the other for 50 books at $35 per book.

A seller like Google could auction off their shares to the highest bidder. This allocation strategy satisfies the bid making the highest offer.

If I use this strategy in my book example, then I will sell 50 books to the highest bidder, at $35 per book.

This strategy risks leaving some shares unsold. But if the highest bidder requests more shares than are available, she is awarded only the number of shares available.

Another approach continues to allocate shares in decreasing order of offer price, until all shares have been sold. But this could be unfair to the highest bidders, who would pay more for their shares than the last bidders. (That may be okay, if we decide that the assurance that you will receive shares is worth the "premium" paid per share.)

To address both of these issues (unsold shares and a fair price to all), the seller can auction off their shares using a Dutch auction allocation strategy. In this approach, the seller satisfies bid in decreasing order of offer price until all shares have been sold. All bidders are charged the price of the lowest successful bid.

If I use a Dutch auction allocation in my book example, then I will sell 50 books to the highest bidder and 50 books to the second bidder. The second bidder makes the lowest successful bid, offering $20 per book, so both bidders are charged $20.

Here is another example, based on one given at eBay:

A seller has 10 pens for auction. Let's say that five people bid $1.50 for one pen each, three people bid $1.25 for one pen each, one person bids $1.00 each for 5 pens, and fifty people bid $0.50 for one pen each.

The final price for all pens is $1.00, even though some folks placed a high bid of $1.50. All winning bidders pay the same price: the lowest successful bid.

This strategy ensures that all shares will be sold, at a price fair to all bidders..

A variation of Dutch auction allows the seller to set a minimum bid. Shares are allocated as described above, unless the offer price ever falls below the minimum, at which time the auction ends -- even if unsold share remain.

Notice that the seller makes a trade-off when choosing between these two strategies. Selling some of the shares at the highest bid price may result in more revenue than selling all of the shares at the last successful bid price.

In my book example, the Dutch auction approach brings in 100 * $20 = $2000. The highest-bidder approach brings in 50 * $35 = $1750. The difference is $2000 - $1750 = $250.

If the highest bidder had bid $42 per book, then the highest-bidder approach brings in 50 * $42 = $2100, and the difference is –$100.

Even when a Dutch auction results in less revenue, it is generally viewed as a fairer way to distribute all shares.


Tasks

Implement a simple auction program consisting of the following components.

You may implement these requirements in any order you choose. But I suggest you start simple, say with Bid, and then add one strategy at a time.


Deliverables

By the due date and time, submit the files

Be sure that your submission follows all homework submission requirements.


Eugene Wallingford ..... wallingf@cs.uni.edu .... January 31, 2005