X935: Accessors and Returns

For this problem you will use this class:

public class Rectangle
{
    private int length;
    private int width;

    public void setLength(int len)
    {
        this.length = len;
    }

    public void setWidth(int w)
    {
        this.width = w;
    }

    public int calculateArea()
    {
        return this.length * this.width;
    }
}

In the method below, you are given a Rectangle r as a parameter. Using the methods above, calculate the area of the Rectangle r and return that value multiplied by 2.

Your Answer:

Reset

Practice a different Java exercise

Feedback

Your feedback will appear here when you check your answer.