/* A PROGRAM THAT USES Box CLASS.
CALL THIS PROGRAM AS BoxDemo.java */
class Box {
double width;
double height;
double depth;
}
// THIS CLASS DECLARES AN OBJECT OF TYPE Box.
class BoxDemo {
public static void main (String args[]) {
Box mybox = new Box();
double volume;
// assign values to the mybox's instance variables
mybox.width = 10;
mybox.height = 20;
mybox.depth = 15;
// compute volume of box
volume= mybox.width * mybox.height * mybox.depth;
System.out.println("Volume of the Box is:" +volume);
}
}
CALL THIS PROGRAM AS BoxDemo.java */
class Box {
double width;
double height;
double depth;
}
// THIS CLASS DECLARES AN OBJECT OF TYPE Box.
class BoxDemo {
public static void main (String args[]) {
Box mybox = new Box();
double volume;
// assign values to the mybox's instance variables
mybox.width = 10;
mybox.height = 20;
mybox.depth = 15;
// compute volume of box
volume= mybox.width * mybox.height * mybox.depth;
System.out.println("Volume of the Box is:" +volume);
}
}