EnglishAuction
description
: String, val startingPrice
: Int, duration
: Int) extends ItemForSale
The class EnglishAuction represents “normal”, “English-style” auctions in an electronic auction house. Each auction object represents an auction for a single item that has been put up for sale.
Each English auction has a starting price for the item being sold. No bids lower than the starting price are accepted. The highest bidder wins the item at the end of the auction. If two bidders bid the same amount, the first bidder wins over the later one. Apart from this, the order in which bids are placed is not significant.
Upon creation, a duration (in days) is set for the auction. Every day, the method advanceOneDay
must be called to update the auction status. Once the time limit is reached, the auction closes and the highest bid wins. If there were no bids made by this time, the auction closes anyway and is considered “expired”.
In a traditional non-electronic auction, all bidders are physically present and it is very common for the same person to make multiple slightly increased bids during the course of the auction, which only lasts a relatively short time. The bidding system in an electronic “English auction” is different. When bidding, bidders indicate the maximum price that they are willing to pay for the item. Storing the maximum bid amount in the electronic auction house is convenient, as it allows bidders to indicate how far they are willing to go, without having to come back to the auction house service repeatedly to increase their bids.
Even if a bidder later wins the auction, they do not necessarily have to pay the full maximum price indicated when placing the bid. They only need to pay enough to beat the second highest bidder. Consider an example. Say bidder A has bid a maximum of 100 for an item and bidder B has bid 150, and the auction then closes. B wins the item and has to pay a price of 101 for it, just enough to beat A’s 100.
The maximum bid amount of the leading bidder is not publicly displayed. The program is intended to display only the current price of the auction and the minimum amount that new bidders must bid in order to stand any chance of winning. For instance, say bidder A has placed a bid with a limit of 200 for an item, and bidder B has placed a bid with a limit of 300. The current price of the auction is now 201. The minimum amount that new bidders must bid is 202 (good enough to beat 201). B’s limit of 300 will not become apparent to other bidders unless someone bids over 300, thereby becoming the leading bidder. (Not displaying the leading bidder’s limit is a sensible policy. Otherwise, bidders or sellers could raise the price without any intention of actually winning the item.)
See Huuto.Net or eBay for descriptions of similar real-world systems.
This simple class does not support bid cancellations, reserve prices, item buyouts, etc., and does not store any seller information.
Parameters
- description
-
a short description of the item
- duration
-
the length of the auction, in days
- startingPrice
-
the initial price of the item, that is, the lowest possible price the seller is willing to accept
Attributes
- See also
- Graph
-
- Supertypes