public class Rectangle {
private int length, width;
public Rectangle(){
}
//Part c
public Rectangle(int len, int w){
length = len;
width = w;
}
public void setLength(int len){
length = len;
}
public void setWidth(int w){
width = w;
} //
public int getArea(){
int area = length*width;
return area;
} //end getArea
public int getPerimeter(){
int perimeter = 2*(length+width);
return perimeter;
} //end getPerimeter
}//end class
Tuesday, October 31, 2006
Practical 6 Q1 (Rectangle) class
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment