import java.util.*;


/**
 * A stock qutation (i.e., open, high, low, close and  volume)
 *
 *
 * @version 1.0
 * @author  Prof. David Bernstein, James Madison University
 *
 */
 public class StockQuotation extends SecurityQuotation
{
    protected TickerSymbol           symbol;



    /**
     * Default constructor
     */
     public StockQuotation()
     {
			symbol = null;
     }


    /**
     * Construct a new StockQuotation
     *
     * @param symbol    The TickerSymbol of the stock
     * @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 StockQuotation(TickerSymbol symbol, 
									 GregorianCalendar date, 
			  						 double open,
									 double high,
									 double low,
									 double close,
                            int volume)
      {
			super(date, open, high, low, close, volume);
			this.symbol = symbol;
      }

    /**
     * Return the symbol for this security
     *
     * @param symbol     The ticker symbol for this stock
     */
     public TickerSymbol getSymbol()
     {
        return symbol;
     }

    /**
     * Parse a String representation of a StockQuotation into 
     * its components and construct a StockQuotation from them.
     *
     * @param stock     The TickerSymbol for the stock
     * @param s         The String representation
     */
     public static StockQuotation parseStockQuotation(TickerSymbol symbol,
						     											String aString) 
                                 throws NoSuchElementException,
                                        NumberFormatException
    {
			StockQuotation       aStockQuotation;
	
			aStockQuotation = new StockQuotation();
			aStockQuotation.symbol = symbol;

			aStockQuotation.parseSecurityQuotation(aString);
	
			return aStockQuotation;
    }
} // end StocktQuotation
