-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathInvoiceList.java
More file actions
44 lines (33 loc) · 1.03 KB
/
InvoiceList.java
File metadata and controls
44 lines (33 loc) · 1.03 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
import java.util.*;
public class InvoiceList {
private List<Invoice> invoices = new LinkedList<Invoice>();
public int size() {
return invoices.size();
}
public Iterator<Invoice> getInvoices() {
return invoices.iterator();
}
public void AddInvoice(cart userCart, int total, Client item3)
{
Invoice newInvoice = new Invoice(userCart,total);
invoices.add(newInvoice);
userCart.emptyCart(item3);
}
public int IDcheck (int ID) {
for (int i=0; i < invoices.size(); i++) {
Invoice temp = invoices.get(i);
if (ID == temp.getId()) {
System.out.println("ID found");
return i;
}
}
System.out.println("ERROR: ID is not in database");
return -1;
}
public Invoice get_listed_obj (int position) {
return invoices.get(position);
}
public void set_listed_obj (int position, Invoice update) {
invoices.set(position, update);
}
}