Write the statement to instantiate an box object bluebox


Assume this Box class:

public class Box
{
double length; double width;
double height;

Box(double l, double w, double h)
{
length = l; width = w; height = h;
}// Box( )

double volume( )
{
return length * width * height;
}// end volume( ) }// end class Box

Write the statement to instantiate an Box object, blueBox, with a length of 6, width of 4, and height of 2.

Write a statement to output the volume of the blue box.

Add a constructor to class Box for a cube, which has only 1 parameter, side.

Write a statement to instantiate a cube with a length of 3, width of 3, and height of 3.

Solution Preview :

Prepared by a verified Expert
JAVA Programming: Write the statement to instantiate an box object bluebox
Reference No:- TGS01482605

Now Priced at $20 (50% Discount)

Recommended (93%)

Rated (4.5/5)