Tuesday, 5 November 2013

A SIMPLE CLASS PROGRAM FOR FINDING THE VOLUME OF A CUBOID

class cuboid
{
int length;
int breadth;
int height;
}
public class classes {
    public static void main(String []args){
        cuboid cube1=new cuboid();
        cuboid cube2=new cuboid();
        int volume1,volume2;
        cube1.length=2;
        cube1.breadth=3;
        cube1.height=4;
        cube2.length=5;
        cube2.breadth=6;
        cube2.height=7;
        volume1=cube1.length*cube1.breadth*cube1.height;
        volume2=cube2.length*cube2.breadth*cube2.height;
        System.out.println("the valume of cube one is = "+volume1);
        System.out.println("the volume of cube two is = "+volume2);
    }
   
}

No comments:

Post a Comment