Define a Class in C++. (ITEM)


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

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


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

Public members
  • ·         A function GetStock() to allow user to enter values for Code, Iname, Price, Qty and call function Getoffer() to calculate offer.
  • ·         A function Showitem() to allow user to view the content of all data member.




No comments

Post your comments

Powered by Blogger.