Start New Discussion within our Software Development Community

After completing my code I got an error message at the second to last closing bracket that said I was missing a return statement, I looked in to it online and found that some said to put return 0; but that didn't work it just gave me a new error that said Incompatible types found: int required: Picture . Any suggestions?

public Picture makeGrid(int size)
{
  Picture targetPicture = new Picture(this.getWidth()*size, this.getHeight()*size);
  Pixel sourcePixel = null;
  Pixel targetPixel = null;
  int targetX = 0;
  int targetY = 0;
  
//loop through the source picture columns
  for(int sourceX = 0; sourceX < this.getWidth(); sourceX++)
  {
//loop through the source picture rows
    for(int sourceY = 0; sourceY < this.getHeight(); sourceY++)
    {
// get the source pixel
      sourcePixel = this.getPixel(sourceX,sourceY);
      
// loop copying to the target y
      for(int indexY = 0; indexY <size; indexY++)
      {
// loop copying to the target x
        for(int indexX = 0; indexX < size; indexX++)
        {
          targetX = sourceX + size*2 + indexX;
          targetY = sourceY + size*2 + indexY;
          targetPixel =targetPicture.getPixel(targetX, targetY);
          targetPixel.setColor(sourcePixel.getColor());
        }
      }
    }
  }
}
}
This question has already been answered. Start a new discussion instead.