Class Auction

java.lang.Object
  |
  +--Auction

public class Auction
extends Object

An Auction is a container for zero or more Items currently up for bid. A User must first log into the auction in order to place a bid on an item.

Author:
Suzanne Menzel

Field Summary
static int MAX_ITEMS
          Constant representing the maximum number of items that can be added to an auction.
 
Constructor Summary
Auction()
          Creates a fresh auction with no items in it.
 
Method Summary
 Auction add(Item item)
          Adds the given item to this auction, if it fits, and then returns this auction.
 void bidOn(int itemNo, int amount)
          Attempts to place a bid on the indicated item for the given amount by the user currently logged in.
 void login(User user, String password)
          Logs the given user into this auction, assuming the supplied password checks out.
 void printHistory(int itemNo)
          Prints the bidding history of the indicated item.
 String toString()
          Returns a textual representation of this auction as a numbered list of items.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

MAX_ITEMS

public static final int MAX_ITEMS
Constant representing the maximum number of items that can be added to an auction.

See Also:
Constant Field Values
Constructor Detail

Auction

public Auction()
Creates a fresh auction with no items in it.

Method Detail

add

public Auction add(Item item)
Adds the given item to this auction, if it fits, and then returns this auction.


login

public void login(User user,
                  String password)
Logs the given user into this auction, assuming the supplied password checks out.


toString

public String toString()
Returns a textual representation of this auction as a numbered list of items.

Overrides:
toString in class Object

bidOn

public void bidOn(int itemNo,
                  int amount)
Attempts to place a bid on the indicated item for the given amount by the user currently logged in. Fails if noone is logged in or if the itemNo is out of range.


printHistory

public void printHistory(int itemNo)
Prints the bidding history of the indicated item. Fails if the itemNo is out of range.