|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectStockExchange
public class StockExchange
Represents a stock exchange. A StockExchange
keeps
a HashMap
of stocks, keyed by a stock symbol. It has methods to
list a new stock, request a quote for a given stock symbol, and
to place a specified trade order.
Constructor Summary | |
---|---|
StockExchange()
Constructs a new stock exchange object. |
Method Summary | |
---|---|
java.lang.String |
getQuote(java.lang.String symbol)
Returns a quote for a given stock. |
void |
listStock(java.lang.String symbol,
java.lang.String name,
double price)
Adds a new stock with given parameters to the listed stocks. |
void |
placeOrder(TradeOrder order)
Places a trade order by calling stock.placeOrder
for the stock specified by the stock symbol in the trade order. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public StockExchange()
HashMap
).
Method Detail |
---|
public void listStock(java.lang.String symbol, java.lang.String name, double price)
symbol
- stock symbol.name
- full company name.price
- opening stock price.public java.lang.String getQuote(java.lang.String symbol)
symbol
- stock symbol.
public void placeOrder(TradeOrder order)
stock.placeOrder
for the stock specified by the stock symbol in the trade order.
order
- a trading order to be placed with this stock exchange.
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |