01: /**
02:    A withdraw runnable makes periodic withdrawals from a bank account.
03: */
04: public class WithdrawRunnable implements Runnable
05: {
06:    /**
07:       Constructs a withdraw runnable.
08:       @param anAccount the account from which to withdraw money
09:       @param anAmount the amount to deposit in each repetition
10:       @param aCount the number of repetitions
11:    */
12:    public WithdrawRunnable(BankAccount anAccount, double anAmount,
13:          int aCount)
14:    {
15:       account = anAccount;
16:       amount = anAmount;
17:       count = aCount;
18:    }
19: 
20:    public void run()
21:    {
22:       try
23:       {
24:          for (int i = 1; i <= count; i++)
25:          {
26:             account.withdraw(amount);
27:             Thread.sleep(DELAY);
28:          }
29:       }
30:       catch (InterruptedException exception) {}
31:    }
32: 
33:    private static final int DELAY = 1; 
34:    private BankAccount account;
35:    private double amount;
36:    private int count;
37: }