/* CSE 333 Su12 lecture 14 demo: stocks_static/Stock.h */ /* Gribble/Perkins */ // Specification of class Stock without virtual methods #ifndef _STOCK_H_ #define _STOCK_H_ #include using namespace std; // A Stock object represents holdings of a single stock. class Stock { public: Stock(string symbol, double share_price = 0.0); // Stock's mutator/accessor methods. void Purchase(int shares, double share_price); string get_symbol() const; int get_shares() const; double get_share_price() const; void set_share_price(double share_price); // Stock's "investment" interface. double GetCost() const; double GetMarketValue() const; double GetProfit() const; // Print out the Stock information. void Print() const; private: string symbol_; // stock symbol int shares_; // number of shares owned double cost_; // total cost of all shares purchased double share_price_; // most recently recorded share price }; #endif // _STOCK_H_