import java.awt.Color; import java.awt.Graphics; public class Balloon { private Color color; private int x,y,width,height, deltaY; public Balloon(int x, int y, int size) { this.x=x; this.y=y; this.width=size; this.height=size+randomInt(5,size); this.deltaY=randomInt(1, 5); int red=randomInt(0, 255); int green=randomInt(0, 255); int blue=randomInt(0, 255); this.color = new Color(red, green,blue); } public void draw(Graphics g){ g.setColor(color); g.fillOval(x, y, width, height); } public void drop(){ this.y+=deltaY; } public int getBottom() { return y+height; } public static int randomInt(int min, int max){ return min+(int)((max-min+1)*Math.random()); } }