-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSupplier.java
More file actions
41 lines (33 loc) · 920 Bytes
/
Supplier.java
File metadata and controls
41 lines (33 loc) · 920 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
import java.util.ArrayList;
public class Supplier {
private int id;
private String companyName;
private String address;
private String salesContact;
private ArrayList<Item> items;
public Supplier(int id, String cn, String address, String sc)
{
this.id = id;
this.companyName = cn;
this.address = address;
this.salesContact = sc;
items = new ArrayList<Item>();
}
public void addItem(ArrayList<Item> items)
{
for (Item i: items){
if(id==i.getSupplierID()) {
this.items.add(i);
i.setSupplier(this);
}
}
}
public String info()
{
return "Supplier:\t\t"+companyName;
}
public String toString()
{
return "Supplier ID: "+ id + ", Company Name: "+ companyName +", address: "+ address +", Sales Contact: " + salesContact;
}
}