X847: changeTo10By4

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 defined above, set its length to 10 and its width to 4.

Your Answer:

Reset

Practice a different Java exercise

Feedback

Your feedback will appear here when you check your answer.