/** Programmer: Mary Rose M. Celmar
Date Started:03-06-09 */
public class Cube{
double Width;
double Height;
double Length;
double area;
double volume;
public Cube(){ }
public Cube( double Twidth, double Theight, double Tlength){ Width=Twidth;
Height=Theight;
Length=Tlength; }
public double volume(double v){
volume=v*v*v;
return volume;
}
public double area(double l,double w, double h){
area=l*w*h;
return area;
}
public void setWidth( double ww)
{ Width=ww;
}
public double getWidth(){
return Width;
}
public void setHeight( double hh){
Height=hh;
}
public double getHeight(){
return Height;
}
public void setLength (double ll){
Length=ll;
}
public double getLength(){
return Length;
}
public void DisplayCube(){
System.out.println("The Cube is%");
}
}
public class CubeTester{
public static void main(String [] args){
Cube x=new Cube();
Cube y=new Cube(20,45,50);
x.setWidth(10);
x.setHeight(15);
x.setLength(25);
System.out.println("The width is:"+x.getWidth());
System.out.println("The Height is:"+x.getHeight());
System.out.println("The Length is:"+x.getLength());
}
}
No comments:
Post a Comment