import java.util.Random; /** This program runs four threads that deposit and withdraw money from the same bank account. Each threads sleeps a random time between trnasactions. */ public class BankAccountThreadTest { public static void main(String[] args) { BankAccount account = new BankAccount(); DepositThread t0 = new DepositThread(account, 100); WithdrawThread t1 = new WithdrawThread(account, 100); DepositThread t2 = new DepositThread(account, 100); WithdrawThread t3 = new WithdrawThread(account, 100); t0.setName("Ann"); /* Ann is a depositor to the team's account */ t1.setName("Bill"); /* Bill always withdraws money */ t2.setName("John"); /* John deposits money to the joint account */ t3.setName("Mary"); /* Mary withdraws only */ t0.start(); t1.start(); t2.start(); t3.start(); } }