rendered paste bodypublic class Rectangle{
// private data fields
private double length;
private double width;
//constructor
public Rectangle( double len, double w)
{
length = len;
width = w;
System.out.println("In Rectangle Constructor!\n");
}
//public method
public void setLength(double len)
{
length = len; //assign len to field length
}
public void setWidth(double wid)
{
width = wid; //assign wid to field width
}
public double getLength()
{
return length;
}
public double getWidth()
{
return width;
}
public double getArea()
{
return (length * width);
}
}