|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--Item
An Item has a description
and a minimal selling price. Bids can be placed on
an item according to the auction rules.
| Constructor Summary | |
Item(String description,
int askingPrice)
Constructs an Item from the
given description and initial asking price. |
|
| Method Summary | |
void |
close()
Closes the bidding on this item. |
int |
getAskingPrice()
Returns the initial asking price of this item. |
String |
getDescription()
Returns the description of this Item. |
Bid |
getHighBid()
Returns either null,
meaning no bid has yet been
accepted on this item, or the current high Bid. |
String |
getHistory()
Returns the history of accepted bids on this item, as a String. |
int |
getNumBids()
Returns the total number of bids accepted on this item so far. |
boolean |
isClosed()
Returns true if and only if the bidding
on this item has been closed, and false
otherwise. |
void |
placeBid(Bid b)
The given Bid is considered for
this item. |
String |
toString()
Returns a textual representation of this item, as a String. |
boolean |
wasBidOn()
Returns true if and only if this item
has an acceptable bid on it, and false
otherwise. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
public Item(String description,
int askingPrice)
Item from the
given description and initial asking price.
| Method Detail |
public String getDescription()
Item.
public void placeBid(Bid b)
Bid is considered for
this item. If the auction on this item has
closed or the ceiling price in
b does not meet or exceed the asking
price on this
item, then an appropriate message is displayed
and the bid is ignored. Otherwise, b is either
accepted or rejected. It is accepted
(i.e., it becomes the current high bid) if it is the
first bid to be placed on this item (in which case,
it is accepted at the item's asking price)
or if its ceiling
price exceeds the ceiling on the current high bid
(in which case it is accepted for one dollar more
than that value). If the bid b is
rejected, then the current high bid must be
raised accordingly to reflect the new offer.
public Bid getHighBid()
null,
meaning no bid has yet been
accepted on this item, or the current high Bid.
public boolean wasBidOn()
true if and only if this item
has an acceptable bid on it, and false
otherwise.
public int getAskingPrice()
public int getNumBids()
public String getHistory()
String.
public void close()
public boolean isClosed()
true if and only if the bidding
on this item has been closed, and false
otherwise.
public String toString()
String. For example:
> wand
Magic wand...$32 (hpotter)
> hat
Sorting hat...no bids yet...min bid is $78
> broom
Broomstick...closed
toString in class Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||