public class Balloon
extends java.lang.Object
Constructor and Description |
---|
Balloon(int max)
Creates a balloon with given maximum radius, but if the given argument
is negative the balloon will have maximum radius 0; initially, the balloon
is deflated (radius is zero) and is not popped.
|
Modifier and Type | Method and Description |
---|---|
void |
blow(int amount)
Increases the radius of the balloon by 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, or
if the given amount is negative).
|
void |
deflate()
Deflates the balloon without popping it (a deflated balloon has radius zero).
|
int |
getRadius()
Returns the current radius of this balloon.
|
boolean |
isPopped()
Determines whether this balloon is popped.
|
void |
pop()
Pops the balloon (a popped balloon has radius zero).
|
public Balloon(int max)
max
- Maximum radius of the balloonpublic void blow(int amount)
amount
- Amount by which radius is be increasedpublic int getRadius()
public boolean isPopped()
public void deflate()
public void pop()