#ifndef _STOCK_H #define _STOCK_H // Stock // A class that can be used to model stock prices/indices // (like S & P 500)/ or Currencies // // Stock() -- default, create an empty stock // Stock(string symbol, -- A stock initialized with data. // char Exchange, // double price, // unsigned int volume, // double volatility, // string name) // // Changing contents of the stock class // void SetSymbol(string symbol) --Sets the symbol of a stock // void SetExchange (char Exchange) --Sets the exchange of a stock // void SetLast(double price) --Sets Last Price (and resets change) // void SetCompanyName(string name) --Sets the Name of the Company // void AddTrade(double Price, --Updates Last, Change, and Volume) // unsigned int shares) // // // Retrieval Functions // // string GetSymbol() -- Returns the Symbol of stock // string GetCompanyName () -- Returns the Company Name // char GetExchange () -- Returns the Exchange 'N' = NYSE, etc. // double GetLast() -- Returns the Last Price Stock Traded at // unsigned int GetVolume() -- Returns the Volume traded of the stock // double GetChange() -- Returns the Net Change in the stock // double GetVolatility() -- Returns the Volatility of Stock // void Print() -- Prints the Stock #include "CPstring.h" class Stock { public: Stock(); Stock(const string & symbol, char Exchange, double price, unsigned int volume, double volatility, const string & name); // accessors string GetSymbol () const; string GetCompanyName () const; char GetExchange () const; double GetLast() const; unsigned int GetVolume() const; double GetChange() const; double GetVolatility() const; void Print() const; // mutators void SetSymbol(const string & symbol); void SetExchange (char Exchange); void SetLast(double price); void SetCompanyName(const string & name); void AddTrade(double Price, unsigned int shares); private: string mySymbol; // Symbol of Stock/thing being traded string myCompanyName; // Company Name char myExchange; // Exchange double myLast; // Last Price Stock was sold at unsigned int myVolume; // Daily Trade Volume double myVolatility; // Weighted (Avg) Volatility double myChange; // Change in stock price }; #endif