-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMasterOrder.java
More file actions
41 lines (32 loc) · 847 Bytes
/
MasterOrder.java
File metadata and controls
41 lines (32 loc) · 847 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
41
/**
@author Sofie Budman
Period 5
*/
import java.util.ArrayList;
public class MasterOrder {
private ArrayList<CookieOrder> orders;
public MasterOrder(){
orders = new ArrayList<CookieOrder>();
}
public void addOrder(CookieOrder theOrder){
orders.add(theOrder);
}
public int getTotalBoxes() {
int total = 0;
for(CookieOrder c : orders){
total += c.getNumBoxes();
}
return total;
}
public int removeVariety(String cookieVar){
int c = 0;
for(int i = 0; i < orders.size(); i ++){
if(orders.get(i).getVariety().equals(cookieVar)){
c += orders.get(i).getNumBoxes();
orders.remove(i);
i--;
}
}
return c;
}
}