Java Program For Finding Volume By Applying SetDimensions

class Box
{
 double width;
 double height;
 double depth;

 void volume()
 {
 System.out.print(" Volume is ");
 System.out.print(width *height*depth);
 }

        void setDim(double width, double height, double depth)
        {
          this.width=width;
   this.height=height;
   this.depth=depth;
       }
}

class BoxDemoCon1
{
public static void main (String args[])
{
Box mybox1= new Box();
Box mybox2= new Box();

mybox1.setDim(10,20,15);
 

mybox2.setDim(3,6,9);
 
mybox1.volume();
mybox2.volume();
}
}
Bhanu Namikaze

Bhanu Namikaze is an Ethical Hacker, Web Developer, Student and Mechanical Engineer. He Enjoys writing articles, Blogging, Solving Errors and Social Networking. Feel Free to let me know any of your concerns about hacking or let me know if you need any more methods on hacking anything. Enjoy Learning

No comments:

Post a Comment