I have these two methods given called leftEyeColor() and rightEyeColor(). And in each of those methods, I must execute this pseudocode:
For leftEyeColor and rightEyeColor methods:
Get world
Get background
Get x and y coordinates of the eye
(Get color from background at eye coordinates)
Return color. (All of these tasks can be done from the return statement)
I tried to put everything inside the return line and it looks like this:
private Color leftEyeColor()
{
Point eyePos = leftEye();
return getWorld().getBackground().getColorAt(eyePos.getX(),eyePos.getY());
}
private Color rightEyeColor()
{
Point eyePos = rightEye();
return getWorld().getBackground().getColorAt(eyePos.getX(),eyePos.getY()); // this is incomplete - fix it
}
This looks right to me but I am being thrown the error: Greenfoot.Color cannot be converted to java.awt.Color A simple fix would be to simply not import java.awt.Color, however, I don't think I am allowed to remove the import for this assignment unfortunately :(