stock20.h 606 B

12345678910111213141516171819202122232425
  1. // stock20.h -- augmented version
  2. #ifndef STOCK20_H_
  3. #define STOCK20_H_
  4. #include <string>
  5. class Stock
  6. {
  7. private:
  8. std::string company;
  9. int shares;
  10. double share_val;
  11. double total_val;
  12. void set_tot() { total_val = shares * share_val; }
  13. public:
  14. // Stock(); // default constructor
  15. Stock(const std::string & co, long n = 0, double pr = 0.0);
  16. ~Stock(); // do-nothing destructor
  17. void buy(long num, double price);
  18. void sell(long num, double price);
  19. void update(double price);
  20. void show()const;
  21. const Stock & topval(const Stock & s) const;
  22. };
  23. #endif