public class Balloon
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
protected int |
maxRadius |
protected boolean |
popped |
protected int |
radius |
| Modifier | Constructor and Description |
|---|---|
protected |
Balloon() |
|
Balloon(int max)
Creates a balloon with given maximum radius; initially, the balloon is deflated (radius is zero) and is not popped.
|
| Modifier and Type | Method and Description |
|---|---|
void |
deflate()
Deflates the balloon without popping it (a deflated balloon has radius zero).
|
boolean |
equals(java.lang.Object o) |
int |
getRadius()
Returns the current radius of this balloon
|
void |
inflate(int amount)
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).
|
boolean |
isPopped()
Determines whether this balloon is popped.
|
void |
pop()
Pops the balloon (a popped balloon has radius zero).
|
java.lang.String |
toString() |
protected int maxRadius
protected int radius
protected boolean popped
protected Balloon()
public Balloon(int max)
max - maxium radius of the balloonpublic boolean equals(java.lang.Object o)
equals in class java.lang.Objectpublic java.lang.String toString()
toString in class java.lang.Objectpublic int getRadius()
public void inflate(int amount)
amount - the amount by which the to increse/decrease the radiuspublic void deflate()
public boolean isPopped()
public void pop()