/** * @author Haiping Xu * Created at the CIS Department, UMass Dartmouth */ import java.util.Random; public class DiffTasks implements Runnable { private int choice; public DiffTasks(int newChoice){ choice = newChoice; } private void delay() { Random random = new Random(); int delay = 0; delay = random.nextInt(1000); try { Thread.sleep(delay); } catch (InterruptedException e) { e.printStackTrace(); } } public void run(){ final int REPETITIONS = 5; switch (choice) { case 1: // task 1 for (int i=0; i