Create a new method at the bottom of Picture.java. The declaration will be as fo
ID: 3624443 • Letter: C
Question
Create a new method at the bottom of Picture.java. The declaration will be as follows:public Picture makeGrid(int size)
{
...
}
This method will create a square grid, size images wide by size images high, of duplicate copies of the original image. To be clear, the actual pixel dimensions of the grid may not be square, they will be proportional to the dimensions of the original image. Rather the number of images in the grid will be square. See the examples below for clarification.
At the beginning of the method you will create a new Picture object for the grid with the correct dimensions. At the end, you should return the new Picture object.
To test your method, use the following code as an example:
String fileName = ".../intro-prog-java/mediasources/caterpillar.jpg";
Picture original = new Picture(fileName);
Picture grid = original.makeGrid(3);
grid.show();
It should work with any image.