-
Notifications
You must be signed in to change notification settings - Fork 1
/
Patron.java
79 lines (70 loc) · 2.36 KB
/
Patron.java
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
/**AUTHOR: Laurence Toal
*CLASS: CS 230 Data Structures
*Final Project
*LAST MODIFIED: 15 December 2011
*CLASS DESCRIPTION: Contains information on a library patron
**/
import java.util.*;
public class Patron {
//instance variables
private String name;
private String cardNumber;
private LinkedList<Book> checkedOut;
private LinkedList<Book> overdue;
private LinkedList<Book> requested;
//constructor: create a patron given a name & card number
public Patron(String name, String cardNumber) {
this.name = name;
this.cardNumber = cardNumber;
LinkedList<Book> checkedOut = new LinkedList<Book>();
LinkedList<Book> overdue = new LinkedList<Book>();
LinkedList<Book> requested = new LinkedList<Book>();
}
/**Returns the name of the patron
*
*@return name a <code>String</code> representing
*the patron's name
**/
public String getName() {
return name;
}
/**Returns the patron's card number
*
*@return cardNumber a <code>long</code> representing
*the patron's card number
**/
public String getCardNumber() {
return cardNumber;
}
/**Returns the books the patron has currently checked out
*
*@return checkedOut a <code>LinkedList</code> of Book objects
*representing the books the patron currently has out
**/
public LinkedList<Book> getCheckedOutBooks() {
return checkedOut;
}
/**Returns the books the patron currently has overdue
*
*@return checkedOut a <code>LinkedList</code> of Book objects
*representing the books the patron currently has overdue
**/
public LinkedList<Book> getOverdueBooks() {
return overdue;
}
/**Returns the books the patron has currently requested
*
*@return checkedOut a <code>LinkedList</code> of Book objects
*representing the books the patron currently has requested
**/
public LinkedList<Book> getRequestedBooks() {
return requested;
}
/**Returns a string representation of a patron
*
*@return a string representation of a patron
**/
public String toString() {
return "[Name: " + name + "\nLibrary Card Number: " + cardNumber + "\nBooks Checked Out: " + checkedOut + "\nBooks Overdue: " + overdue + "\nBooks Requested: " + requested;
}
}