11. Given the following class
import java.util.ArrayList;
public class RectangleTester
{
public static void main(String[ ] args)
{
ArrayList< Rectangle > shapes = new ArrayList< Rectangle >();
shapes.add(new Rectangle(1, 1));
shapes.add(new Rectangle(2, 2));
shapes.add(new Rectangle(3, 3));
shapes.add(new Rectangle(4, 4));
Rectangle dataRecord;
for(int index = 0; index < shapes.size(); index++)
{
dataRecord = shapes.get(index);
dataRecord.calcRectArea();
dataRecord.calcRectPerimeter();
System.out.println(Area = + dataRecord.getArea());
System.out.println(Perimeter = + dataRecord.getPerimeter());
}
}
}
Assume that getArea() returns the area of a rectangle and getRectPerimeter() returns the perimeter of a rectangle. What will print when index = 3? (3 points)
Question 11 options:
1) Area = 9
Perimeter = 12
2) Area = 4
Perimeter = 8
3) Area = 16
Perimeter = 16
4) Area = 25
Perimeter = 20
5) Area = 1
Perimeter = 4