Im learning C++ and have just started using Objects so i made a pgm to get the the volume from different size boxes. the pgm runs good but i want to now if im using the proper way to code Objects.

Code:#include <iostream> #include <math.h> using namespace std; class Box { public: double length; double breadth; double height; double base; double depth; double radius; //Memebr function decleration double getVolume(void); double getVolumeTri(void); double getVolumeCyl(void); double getVolumeCone(void); void setLength( double len); void setBreadth( double bre); void setHeight( double hei); void setBase (double bas); void setDepth (double dep); void setRadius(double rad); }; //functions begin double Box::getVolume(void)//volume for square box 1 and 2 { return length * breadth * height; } double Box::getVolumeTri(void)//volume for triangle box { return 0.5 * base * height * depth; } double Box::getVolumeCyl(void)//volume of cyllinder { return M_PI * radius * radius * height; } double Box::getVolumeCone(void)//volume for cone { return 0.33333 * M_PI * M_PI * height; } void Box::setLength (double len) { length = len; } void Box::setBreadth (double bre) { breadth = bre; } void Box::setHeight (double hei) { height = hei; } void Box::setBase (double bas) { base = bas; } void Box::setDepth (double dep) { depth = dep; } void Box::setRadius (double rad) { radius = rad; } int main() { Box Box1; Box Box2; Box Box3; Box Box4; double volume = 0.0; double volumeCone = 0.0; double volumeTri = 0.0; double volumeCyl = 0.0; int choice; cout << "for box choose 1: "<< endl << endl << "for cone box choose 2: "<< endl << endl << "for triangle box choose 3: "<< endl << endl << "for Cyllinder choose 4: "<< endl << endl; cin >> choice; switch (choice) { case 1: //box 1 specs cout << "What is your height for the box in inches: " << endl; cin >> Box1.height; cout << "What is your lenth for the box in inches: " << endl; cin >> Box1.length; cout << "What is your width for the box in inches: " << endl; cin >> Box1.breadth; //volume of box 1 volume = Box1.getVolume(); cout << "Volume of Box = " << volume <<" "<< "cubic inches" << endl << endl; break; case 2: //box 2 specs cout << "What is your height for the cone in inches: " << endl; cin >> Box2.height; cout << "What is your radius for the cone in inches: " << endl; cin >> Box2.radius; volumeCone = Box2.getVolumeCone(); cout << "Volume of Cone = " << volumeCone <<" "<< "cubic inches" << endl << endl; break; case 3: //triangle box cout << "What is your height for the triangle box in inches: " << endl; cin >> Box3.height; cout << "What is your base for the triangle box in inches: " << endl; cin >> Box3.base; cout << "What is your depth for the box in inches: " << endl; cin >> Box3.depth; //volume of a triangle volumeTri = Box3.getVolumeTri(); cout << "Volume of Triangle Box = " << volumeTri <<" "<< "cubic inches" << endl << endl; break; case 4: //cyllinder cout << "What is your height of the cylllinder in inches: " << endl; cin >> Box4.height; cout << "What is the radius for the cyllinder in inches: " << endl; cin >> Box4.radius; //volume of a cyllinder volumeCyl = Box4.getVolumeCyl(); cout << "Volume of Cyllinder = " << volumeCyl <<" "<< "cubic inches" << endl << endl; break; } return 0; }

disagrees : Inane an pointless comment not appreciated.