Define a Class in C++. (STOCK)


Define a class STOCK in C++ with the following specification:

Private members
  • ·         ICode of type integer (Item Code)
  • ·         Item of type string (Item Name)
  • ·         Price of type float (Price if each item)
  • ·         Qty of type integer (Quantity in stock)
  • ·         Discount of type float (Discount percentage on the item)
  • ·         A member function Getoffer() to calculate offer percentage as follows:


If Qty <=50
Discount is 0
If 50< Qty<=100
Discount is 5
If Qty>100
Discount is 10

Public members
  • ·         A function Buy() to allow user to enter values for ICode, Item, Price, Qty and call function FindDisc() to calculate discount.
  • ·         A function Showall() to allow user to view the content of all data member.




No comments

Post your comments

Powered by Blogger.