Write a class called boxVolume with length, width and height as data members and readData(), dispData() and computeVol() as functions. Also write a main() function to test the boxVolume class.
i tried -
#include <iostream>
class BoxVolume
{
public:
float length;
float width;
float height;
void readData()
{
using namespace std
cout << "length: ";
cin >> 'BoxVolume::length';
cout << "width: ";
cin >> 'BoxVolume::width';
cout << "height: ";
cin >> 'BoxVolume::height';
}
void computeVolume()
{
float volume;
volume = 'void readData()::length' * 'void readData()::width' * 'void readData()::height';
}
void dispData()
{
using namespace std
cout << "Volume is:" << 'void computeVolume()::volume';
}
};
int main()
{
BoxVolume obj1,obj2,obj3;
obj1.readData();
obj2.computeVolume();
obj3.dispData();
};