Friday, March 20, 2009

Cube

public class Cube{

private double width;
private double length;
private double height;
private double volume;
private double area;

public Cube(double w,double h,double l)
{
width=w;
height=h;
length=l;
}

public Cube()
{
}

private double volume()
{
return=width*length*height;
}

private double area()
{
return=width*length;
}

public void Dimension(double nLength, double nHeight, double nWidth)
{
length=nLength;
width=nWidth;
height=nHeight;
}

public void displayCube()
{
System.out.println("The volume of the Cube:"+volume());
System.out.println("the area of the Cube:"+area());
}

}

No comments:

Post a Comment