-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathWaitTime.java
59 lines (49 loc) · 1.1 KB
/
WaitTime.java
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
/**
* Keeps track of all the customer wait time
* @Lekso Borashvili
* @version (a version number or a date)
*/
import java.util.ArrayList;
public class WaitTime
{
private ArrayList<Integer> wt = new ArrayList<Integer>();
/**
* adds wait time to the list
* @param a wait time
*/
public void addtoWaitTime(int a)
{
wt.add(a);
}
/**
* returns i-th element from the wait time array
* @param i index in array
* @return i-th element value
*/
public int getfromWaitTime(int i)
{
return wt.get(i);
}
/**
* returns the size of wait time array
* @return wait time array size
*/
public int WaitTimeSize()
{
return wt.size();
}
/**
* returns the average wait time of every customer
* @return average wait time
*/
public int avgWaitTime()
{
int ans = 0;
for(int i=0;i<wt.size();i++)
{
ans+=wt.get(i);
}
if(wt.size()==0) return 0;
return ans/wt.size();
}
}