public class Washer
extends java.lang.Object
Washer
simulates a simple washing machine.
Java Source Code for this class:
http://www.cs.colorado.edu/~main/edu/colorado/simulations/Washer.java
Constructor and Description |
---|
Washer(int s)
Initialize a washer.
|
Modifier and Type | Method and Description |
---|---|
boolean |
isBusy()
Determine whether this washer is currently busy.
|
void |
reduceRemainingTime()
Reduce the remaining time in the current wash cycle by one second.
|
void |
startWashing()
Start a wash cycle going for this washer.
|
public Washer(int s)
s
- the number of seconds required for one wash cyle of this washer
Postcondition:
This washer has been initialized so that it takes s
seconds to complete one wash cycle.public boolean isBusy()
true
if this washer is busy (in a wash cycle);
otherwise false
public void reduceRemainingTime()
public void startWashing()
isBusy()
is false
.
Postcondition:
This washer has started simulating one wash cycle. Therefore,
isBusy()
will return true
until the required
number of simulated seonds have passed.java.lang.IllegalStateException
- Indicates that this washer is busy.