-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPatron.java
More file actions
43 lines (32 loc) · 810 Bytes
/
Patron.java
File metadata and controls
43 lines (32 loc) · 810 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;
import java.util.List;
public class Patron {
private String name;
private int id;
private List<Item> checkedOutItems;
public Patron(String name, int id){
this.name = name;
this.id = id;
this.checkedOutItems = new ArrayList<>();
}
public void checkedOutItem(Item item){
if(checkedOutItems.size() < 10){
checkedOutItems.add(item);
}
}
public void returnItem(Item item){
checkedOutItems.remove(item);
}
public int getNumItemsCheckedOut(){
return checkedOutItems.size();
}
public String getName(){
return name;
}
public int getId(){
return id;
}
public List<Item> getCheckedOutItems(){
return checkedOutItems;
}
}