Define a Class in C++. (GARMENTS)


Define a class Garments in C++ with the following description:

Private members
  • ·         GCode of type string
  • ·         Gtype of type string
  • ·         GSize of type integer
  • ·         GFabric of type string
  • ·         GPrice of type float
  • ·         A function Assign() which calculates and assigns the value of GPrice as follows:For GFabric other than “COTTON” the above mentioned GPrice gets reduced by 10%.


Public members
  • ·         A constructor to assign initial values of GCode, GType and GFabric with the word “NOT ALLOTTED” and GSize and GPrice with 0.
  • ·         A function inut() to input the values of the data members of GCode, GType, GFabric, GSize and invoke the Assign() function.
  • ·         A function Display() which displays the content of all the data members for a Garment. for the GFabric as “COTTON”




No comments

Post your comments

Powered by Blogger.