/*Programmer: Norfe Gregorio
*Programme Name: Cube
*Subject: IT134
*Instructor: Mr. Dony Dongiapon
*Date stated: 02/04/09
*Date end: 02/04/09
*/
public class Cube{
private double width;
private double length;
private double height;
public Cube(double w, double h, double l)
{
this.width=w;
this.height=h;
this.length=l;
}
public Cube()
{
}
private double volume()
{
return width*length*height;
}
private double area()
{
return width*length;
}
public void setDimension(double nw, double nh, double nl)
{
this.width=nw;
this.height=nh;
this.length=nl;
}
public String displayCube()
{
return String.format(volume()+" and "+area());
}
}
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment