// A program that uses the Box class
// Name this file BoxDemo.java
class Box
{
	double	width;
	double	height;
	double	depth;

	// Box constructor
	Box()
	{
		this.width = 0;
		this.height = 0;
		this.depth = 0;
	}
	// Box constructor with dimension setting
	Box( double width, double height, double depth )
	{
		this.width = width;
		this.height = height;
		this.depth = depth;
	}

	// Display the volume of the box
	double volume()
	{
		return width * height * depth;
	}
	// Set the values of Box
	void setDimensions( double width, double height, double depth )
	{
		this.width = width;
		this.height = height;
		this.depth = depth;
	}
}

// This class declares an object of type Box.
class BoxDemo
{
	public static void main( String args[])
	{
		Box	mybox1 = new Box();
		Box	mybox2 = new Box( 100.0, 200.0, 150.0 );
		Box	mybox3 = new Box();
		double	vol1;
		double	vol2;
		double	vol3;

		// Assign values to mybox1's instance variables
		mybox1.width = 10;
		mybox1.height = 20;
		mybox1.depth = 15;
		// Assign values to mybox2's instance variables
		mybox3.setDimensions( 1000.0, 2000.0, 1500.0 );

		// Compute volume of the boxes
		vol1 = mybox1.volume();
		vol2 = mybox2.volume();
		vol3 = mybox3.volume();

		System.out.println("Volume of mybox1 is " + vol1);
		System.out.println("Volume of mybox2 is " + vol2);
		System.out.println("Volume of mybox3 is " + vol3);

	}
}	
