title: inventory class question
body: <p>I'm trying to calculate the total cost of inventory items using the inventory class, i'm getting a few error messages and i can't figure out why, the errors are undeclared identifiers in the imp file of my ... Here's what i have so far.</p>
  
  <p>Inventory.h</p>
  
  <pre><code>#include &lt;string&gt;
  #include &lt;iostream&gt;
  using namespace std;
  
  
  class Inventory 
  {
  public:
      void print() const;
      void setItemNumber(int num);
      void setQuantity(int qty);
      void setCost(double cst);
      void setTotalCost(double total);
      int getItemNumber() const;
      int getQuantity() const;
      double getCost() const;
      double getTotalCost () const;
  
      Inventory(int num = 0, int qty = 0, double cst = 0, double total = 0);
      Inventory(int num, int qty, double cst, double total);
  
  
  private:
      int itemNumber;
      int quantity;
      double cost;
      double totalCost;
  
  
  };
  </code></pre>
  
  <p>InventoryImp.cpp</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include "InventoryClass.h"
  
  using namespace std;
  
  
  void Inventory::print() const
  {
      if (itemNumber &gt; 0 &amp;&amp; quantity &gt; 0 &amp;&amp; cost &gt; 0)
          cout &lt;&lt; itemNumber &lt;&lt; quantity &lt;&lt; cost
                  &lt;&lt; totalCost;
  }
  
  void Inventory::setCost(double cst)
  {
      cost = cst;
  }
  
  void Inventory::setItemNumber(int num)
  {
      itemNumber = num;
  }
  
  void Inventory::setQuantity(int qty)
  {
      quantity = qty;
  }
  
  void Inventory::setTotalCost(double total)
  {
      totalCost = total;
  }
  
  double Inventory::getCost() const
  {
      return cst;
  }
  
  int Inventory::getItemNumber() const
  {
      return num;
  }
  
  int Inventory::getQuantity() const
  {
      return qty;
  }
  
  double Inventory::getTotalCost() const
  {
      return qty * cst;
  } 
  
  
  Inventory::Inventory(int num, int qty, double cst, double total)
  {
      cost = cst;
      quantity = qty;
      totalCost = total;
      itemNumber = num;
  }
  Inventory::Inventory(int num, int qty, double cst, double total)
  {
      cost = cst;
      quantity = qty;
      totalCost = total;
      itemNumber = num;
  }
  </code></pre>
  
  <p>Main.cpp</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include "InventoryClass.h"
  using namespace std;
  
  int main()
  {
      Inventory Item1(101, 6, 3.00);
      Inventory Item2(102, 1, 1.00);
      Inventory Item3(103, 8, 7.00);
      Inventory Item4(104, 4, 12.00);
      Inventory Item5(105, 6, 5.00);
      Inventory Item6(106, 3, 9.00);
  
      Item1.print();
      cout &lt;&lt; endl;
      Item2.print();
      cout &lt;&lt; endl;
      Item3.print();
      cout &lt;&lt; endl;
      Item4.print();
      cout &lt;&lt; endl;
      Item5.print();
      cout &lt;&lt; endl;
      Item6.print();
      cout &lt;&lt; endl;
  
      return 0;
  }
  </code></pre>