JAVA Question Write a processing sketch that contains an arr
JAVA Question
Write a processing sketch that contains an array of 10 Ball objects and displays them on the screen. When the user clicks the sketch, the balls should fall towards the bottom of the screen. The Ball class should have the following private data fields: size xPos yPos The Ball class should have the following methods: setSize (passing an int for the size) setPosition (passing 2 ints for x and y position getXPostion getYPostion getSize drop (drop method should move the ball down the screen 1 pixel at a timeSolution
public class Ball {
   private int size;
    private int xPos;
    private int yPos;
   /**
    * @param size
    */
    public void setSize(int size) {
        this.size = size;
    }
   /**
    * @param x
    * @param y
    */
    public void setPosition(int x, int y) {
        this.xPos = x;
        this.yPos = y;
    }
   /**
    * @return the size
    */
    public int getSize() {
        return size;
    }
   /**
    * @return the xPos
    */
    public int getXPos() {
        return xPos;
    }
   /**
    * @return the yPos
    */
    public int getYPos() {
        return yPos;
    }
   /**
    * method drop 1 pexel at time at down side
    *
    */
    public void drop() {
this.xPos -= 1;
}
}


