Write an object-based program to find the volume of 3 long Fang (Bulk).
Data members include length (length), Width (width), height (heigth), volume, and require design member functions to implement the following functions:
(1) by the keyboard input 3 long Fang long, wide, high;
(2) Calculating the volume (volume) and surface area of the long Fang (areas);
(3) Output the volume and surface area of these 3 long Fang;
#include <iostream>
using namespace Std;
Class Bulk
{
Double L, W, H;
Public
void volume (double, double, double);
void areas (double, double, double);
};
void Bulk::volume (Double L, double W, double h)
{
cout << "Volume:" << l*w*h << Endl;
}
void Bulk::areas (Double L, double W, double h)
{
cout << "surface area:" << l*w * 2 + l*h * 2 + w*h * 2;
}
void Main ()
{
Bulk B1;
cout << "Enter the length, width and height of 3 cuboid respectively:" <<ENDL;
int i = 0;
Double b[9];
for (; I <= 8; ++i)
{
if (i%3==0)
cout << i/3+1 << ".";
CIN >> B[i];
}
for (int j = 0; J <=2; ++j)
{
cout << "cuboid" << j+1;
B1.areas (B[J * 3], B[j * 3 + 1], B[j * 3 + 2]);
B1.volume (B[J * 3], B[j * 3 + 1], B[j * 3 + 2]);
}
Cin >> I;
}
Next week Items-2