You are on page 1of 1

Create an Inventory class that a warehouse might use to represent their stock of products

and raw materials. Include a data member of type string to provide a description of the
product, and data member of type int to represent the balance stock. Provide a constructor
that receives an initial product and uses it to initialize the data members. The constructor
should validate the initial product to ensure it has a stock greater than 20, which is the
company’s minimum stock level. If not, it should display an error message. Provide three
member functions. Member function Purchase should add a product to the current stock.
Member function Sale should reduce stock. Ensure after each sale that the stock level does
not drop below 20. Member function getStock should return the current stock. Create a
program that creates two Inventory objects and tests the member functions of the class.

Consider class Complex, The class enables operations on so-called complex numbers. These
are numbers of the form real-Part + imaginary-Part* i, where i has the value √-1
1. Modify the class to enable input and output of complex numbers via overloaded >>
and << operators, respectively (you should remove the print function from the class).
2. Overload the multiplication operator to enable multiplication of two complex
numbers as in algebra.
3. Overload the == and != operators to allow comparisons of complex numbers.

You might also like