action
Class Transaction
java.lang.Object
action.Transaction
public class Transaction
- extends java.lang.Object
This class represents a transaction between two participants for a single commodity and a single currency on a decided price
and quantity. This class could be thought of as a certificate describing the transaction between to participants.
- Author:
- tratch
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Transaction
public Transaction(Buyer theBuyer,
Seller theSeller,
Commodity theTradedComm,
double qty,
Commodity currency,
double price)
- Constructor. Upon instantiation the finializeDeal() method is called to make the exchange of the commodities
- Parameters:
theBuyer
- theSeller
- theTradedComm
- qty
- currency
- price
-
getCommodityTraded
public Commodity getCommodityTraded()
- Returns:
- the commodity that is being traded in this transaction
getCurrency
public Commodity getCurrency()
- Returns:
- the currency used to conduct this transaction
getPrice
public double getPrice()
- Returns:
- the price agreed on for the commodity traded
getQuantity
public double getQuantity()
- Returns:
- the quantity of the traded good that was agreed on
getTheBuyer
public Buyer getTheBuyer()
- Returns:
- the buyer in this transaction
getTheSeller
public Seller getTheSeller()
- Returns:
- the seller in this transaction
toString
public java.lang.String toString()
- Returns a string representation of this transaction by outputting that a transaction was made between a specified buyer
a specified seller for a given quantity of a given good, for a given price of a given currency.
- Overrides:
toString
in class java.lang.Object
- See Also:
Object.toString()