public class Balloon { private int maxRadius; private int radius; private boolean popped; /** * Creates a balloon with given maximum radius; initially, the balloon is deflated (radius is zero) and is not popped. * @param max maxium radius of the balloon */ public Balloon(int max) { maxRadius = max; radius = max; popped = false; } /** * Returns the current radius of this balloon */ public int getRadius(){ return radius; } /** * Increases the radius of the balloon by a specified amount causing it to pop if the radius is increased beyond the maximum radius (this method has no effect if the balloon is already popped). * @param amount the amount by which the to increse the radius */ public void inflate(int amount){ radius+=amount; } /** * Deflates the balloon without popping it (a deflated balloon has radius zero).0 */ public void deflate(){ maxRadius = 0; } /** * Determines whether this balloon is popped. */ public boolean isPopped(){ return popped; } /** * Pops the balloon (a popped balloon has radius zero). */ public void pop(){ radius = 0; } }