-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAssignment2.java
More file actions
66 lines (38 loc) · 1.6 KB
/
Assignment2.java
File metadata and controls
66 lines (38 loc) · 1.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
import java.util.Scanner;
import java.util.concurrent.ThreadLocalRandom;
public class Assignment2 {
public static void main(String args[]) {
// Driver driver = new Driver(90, 23);
Scanner scan = new Scanner(System.in);
System.out.print("Mean inter-arrival time: " );
int avgInterarrivalTime = scan.nextInt();
System.out.print("Mean service time: ");
int avgServiceTime = scan.nextInt();
System.out.print("Number of tellers: ");
int numTeller = scan.nextInt();
System.out.print("Length of simulation: ");
int lenSim = scan.nextInt();
Random_Int_Mean g = new Random_Int_Mean();
Customer customer = new Customer(10);
Teller teller = new Teller(3);
//Thread tellerThread = new Thread(teller);
// Thread customerThread = new Thread(customer);
teller.start();
while(true)
{
try {
Thread.sleep((g.random_int(avgInterarrivalTime / 10)) * 10); // Sleep until next person gets in
}catch (InterruptedException e){}
System.out.println((g.random_int(avgInterarrivalTime / 10)) * 10 + " ave");
System.out.println((g.random_int(avgServiceTime / 10))*10 + " serve");
customer.start();
}
// try {
// customer.join();
// teller.join();
// } catch (InterruptedException e) {
// // TODO: handle exception
// }
//
}
}