import java.awt.*; // For the graphics features public class Balloon { /** The balloon's diameter */ private int diameter; /** The balloon's position */ private int xCoord, yCoord; /** The balloon's colour */ private Color color; /** * Constructor for the Balloon object * * @param initialDiameter Initial diameter * @param initialX Initial x coordinate * @param initialY Initial y coordinate * @param initialColor Initial colour for the balloon */ public Balloon( int initialDiameter, int initialX, int initialY, Color initialColor ) { // Initialize instance variables diameter = initialDiameter; xCoord = initialX; yCoord = initialY; color = initialColor; } // End of Balloon constructor /** * Call this method to alter the size of the balloon * * @param change This is added to the current diameter */ public void changeSize( int change ) { diameter = diameter + change; } // End of changeSize /** * Call this method to move the balloon * * @param xChange This should be added to the current x coordinate * @param yChange This should be added to the current y coordinate */ public void move( int xChange, int yChange ) { xCoord = xCoord + xChange; yCoord = yCoord + yChange; // Insert statements to adjust the balloon's position here } // End of move /** * Call this method to change the balloon's colour attribute * * @param newColor The new balloon colour */ public void setBalloonColor( Color newColor ) { color = newColor; } // End of setBalloonColor /** * Draw a pictorial view of the balloon * * @param g Where to draw */ public void display( Graphics g ) { g.setColor( color ); g.fillOval( xCoord, yCoord, diameter, diameter ); } // End of display /** * Draw a textual "view" of the balloon * * @param g Where to draw */ public void describe( Graphics g ) { // In the balloon's current colour, display a message block like this: g.setColor( color );// g.drawString("Balloon diameter:"+diameter,50,50); g.drawString("At position x:"+xCoord,50,70); g.drawString("At position y:"+yCoord,50,90); // g.drawString("with the B of Balloon positioned at the balloon's xCoord and yCoord"+xCoord+yCoord, 20,20); //g.drawString("Total is "+total, 80,120 ); } // End of describe } // End of class Balloon