import java.util.GregorianCalendar;

/**
 * A future's contract quotation (i.e., open, high, low, close,
 * volume, and open interest).
 *
 * @author  Prof. David Bernstein, James Madison University
 * @version 1.0
 */
public class FutureQuotation extends SecurityQuotation
{
    protected int              openInterest;
    protected String           commodity, month, year;

    /**
     * Explicit Value Constructor.
     *
     * @param commodity The commodity code
     * @param year      The year code
     * @param month     The month code
     * @param date      The date of the entry
     * @param open      The opening price
     * @param high      The high price
     * @param low       The low price
     * @param close     The closing price
     * @param volume    The volume traded
     */
    public FutureQuotation(String commodity, String year, String month, 
                           GregorianCalendar date, 
			   double open,double high,double low,double close,
                           int volume, int openInterest)
    {
	super(date, open, high, low, close, volume);

        this.commodity    = commodity;
        this.year         = year;
        this.month        = month;
	this.openInterest = openInterest;
    }

    /**
     * Return the open interest for this security.
     *
     * @return  The open interest
     */
    public int getOpenInterest()
    {
        return openInterest;
    }

    /**
     * Return the symbol for this security.
     *
     * @param symbol     The ticker symbol for this stock
     */
    public String getSymbol()
    {
        return commodity + year + month;        
    }

    /**
     * Return a String representation.
     *
     * @return   The String representation
     */
    public String toString()
    {
	return (super.toString()+"\tOI: " + openInterest);
    }
}
