I can't seem to get my access to the private xCoor and yCoor. I try couple of things i just learn in school but none of em make sense. Can someone explain and tell me a way to get access to those xCoor, yCoor, width, and height while still leaving them private in class snowperson?
import java.awt.*;
class snowperson
{
private int xCoor;
private int yCoor;
private int width;
private int height;
public snowperson()
{
xCoor = 0;
yCoor = 0;
width = 0;
height = 0;
}//end default
public snowperson(int x, int y, int wid, int hght)
{
xCoor = x;
yCoor = y;
width = wid;
height = hght;
}//end default
public int getX()
{
return xCoor;
}
public int getY()
{
return yCoor;
}
public int getH()
{
return height;
}
public int getW()
{
return width;
}
public void drawSnowBottom(Graphics g)
{
g.fillOval(xCoor,yCoor,width, height);
}//end draw snow bottom
public void drawSnowMiddle(Graphics g)
{
g.fillOval(xCoor+19, yCoor-128,width-40, height-40);
}//end draw snow middle
public void drawSnowTop(Graphics g)
{
g.fillOval(xCoor+50, yCoor-211, width/2, height/2);
}//end draw snow top
public void drawSnowperson(Graphics g)
{
g.setColor(Color.white);
drawSnowBottom(g);
drawSnowMiddle(g);
drawSnowTop(g);
}//end draw snow person
}//end class SnowpersonAG
class snowSanta extends snowperson
{
public void drawHat(Graphics g)
{
g.setColor(Color.red);
int xHat[] = {xCoor+50, xCoor+150, xCoor+160, xCoor+170, xCoor+160, xCoor+150, xCoor+125, xCoor+100, xCoor+75};
int yHat[] = {yCoor-200, yCoor-200, yCoor-180, yCoor-225, yCoor-250, yCoor-260, yCoor-250, yCoor-225, yCoor-215};
int nHat = 9;
g.fillPolygon(xHat, yHat, nHat);
}
}//end classs snowSanta