Write a class definition based on the following: (1) The name of the class shoul
ID: 1858837 • Letter: W
Question
Write a class definition based on the following:
(1) The name of the class should be “Tableâ€.
(2) The main function should be able to declare a Table object with any of the following:
Table myTable;
Table myTable("Kitchen");
Table myTable("Kitchen", "Particle Board", 49.95);
Thus, you will need three constructors.
(3) The class should have three private data values. Two are string objects and one is a float variable. The string objects are “purpose†and “material†and the float variable is “costâ€.
(4) The class should have a three accessors and three mutators. So, for example, the main function should be able to include the following commands:
cout << "Please enter the cost: ";
cin >> c;
myTable.setCost(c);
cout << "This " << myTable.getPurpose() << " table "
<< is made of << myTable.getMaterial()
<< " and cost me $" << myTable.getCost()
<< " dollars." << endl;
It should also be able to set the material and the purpose.
(5) The class should have a member function for displaying information about the table. The main function should be able to give this command:
myTable.displayData();
and the following will appear on the screen:
This [purpose] table is made of [material] and costs $[cost] dollars.
where the quantities in brackets will be filled in by the function.
You should submit a minimum of three files, two cpp files and an h file. One cpp file contains your main function. The other cpp file is called Table.cpp and contains the member function definitions. The third file is Table.h and it contains the class command with the prototypes for the member functions.