-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathWidgetRepairs.java
More file actions
40 lines (34 loc) · 1009 Bytes
/
WidgetRepairs.java
File metadata and controls
40 lines (34 loc) · 1009 Bytes
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
public class WidgetRepairs {
int days_to_operature = 0;
int remaining_work = 0;
public int days(int[] arrivals, int numPerDay) {
for (int count = 0; count <= arrivals.length - 1; count++) {
arrivals[count] += remaining_work;
if (count <= arrivals.length - 2 && arrivals[count] >= numPerDay) {
days_to_operature++;
} else if (count <= arrivals.length - 2 && arrivals[count] < numPerDay) {
if (arrivals[count] != 0) {
days_to_operature++;
}
} else if (count == arrivals.length - 1) {
days_to_operature += returnlastcount(arrivals[count],numPerDay);
}
if (arrivals[count] > numPerDay) {
remaining_work = arrivals[count] - numPerDay;
} else {
remaining_work = 0;
}
}
// days_to_operature = count;
return days_to_operature;
}
int returnlastcount(int number, int numPerDay) {
int result=0;
if (number % numPerDay == 0) {
result = (number/numPerDay);
} else {
result = (number/numPerDay) + 1 ;
}
return result;
}
}