class Rectangles
{
//长方形的长
int length;
//长方形的宽
int width;
public int perimeter(int length,int width)
{
return 2*(width+length);
}
public int area(int length,int width)
{
return length*width;
}
}
class rectanglesTest
{
public static void main(String[]args)
{
Rectangles r=new Rectangles();
int zhouchang=r.perimeter(3,5);
int mianji=r.area(3,5);
System.out.println(zhouchang);
System.out.println(mianji);
}
}
|