I am making a project where I need to create a method that will be create two different purple colored splotches which will be called in a different program. This is the code I have:
public class PaintablePicture extends Picture
{
public PaintablePicture(String fileName)
{super(fileName);}
public void purpleSplotch(int x,int y)
{
int x=0;
int y=1;
while(x < x*2)
while(y < y*3)
{
Color purple = new Color(175, 0, 175);
Pixel pixRef;
pixRef= this.getPixel(x,y);
pixRef.setColor(purple);
}
return;
}
In the other program where I am calling it I have:
FileChooser.pickMediaPath();
PaintablePicture pRef;
pRef = new PaintablePicture(FileChooser.pickAFile());
pRef.purpleSplotch(10,20);
pRef.explore();
I have to make a while loop that uses variables in order to make the splotches and I don't understand help me please I get the "Error: Duplicate local variable x"