-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBorrow.java
More file actions
181 lines (165 loc) · 3.83 KB
/
Borrow.java
File metadata and controls
181 lines (165 loc) · 3.83 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
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
import java.util.Date;
/**
* A class representing a single borrow from a library
*
* @author Joshua
* @version 1.0
*/
public class Borrow
{
private int borrowId;
private Member member;
private Book book;
private Date dateBorrowed;
private Date dateReturned;
/**
* Borrow Constructor
*
* @param borrowId
* The Borrow Object's Id
* @param member
* The Member Object Related to this Borrow Object
* @param book
* The Book Object Related to this Borrow Object
*/
public Borrow(int borrowId, Member member, Book book)
{
this.borrowId = borrowId;
this.member = member;
this.book = book;
dateBorrowed = new Date();
}
/**
* Borrow Constructor
*
* @param borrowId
* The Borrow Object's Id
* @param member
* The Member Object Related to this Borrow Object
* @param book
* The Book Object Related to this Borrow Object
* @param dateBorrowed
* The Date this Borrow Object was created.
*/
public Borrow(int borrowId, Member member, Book book, Date dateBorrowed)
{
this.borrowId = borrowId;
this.member = member;
this.book = book;
this.dateBorrowed = dateBorrowed;
}
/**
* Borrow Constructor
*
* @param borrowId
* The Borrow Object's Id
* @param member
* The Member Object Related to this Borrow Object
* @param book
* The Book Object Related to this Borrow Object
* @param dateBorrowed
* The Date this Borrow Object was created
* @param dateReturned
* The Date this Borrow Object was closed
*/
public Borrow(int borrowId, Member member, Book book, Date dateBorrowed, Date dateReturned)
{
this.borrowId = borrowId;
this.member = member;
this.book = book;
this.dateBorrowed = dateBorrowed;
this.dateReturned = dateReturned;
}
/**
* Gets the borrow id of the Borrow Object.
*
* @return The Borrow Object's Id
*/
public int getBorrowId() {
return borrowId;
}
/**
* Sets the borrow id of the Borrow Object.
*
* @param borrowId
* The id you wish to assign to this Borrow Object
*/
public void setBorrowId(int borrowId) {
this.borrowId = borrowId;
}
/**
* Gets the Member Object related to this Borrow Object.
*
* @return member
*/
public Member getMember() {
return member;
}
/**
* Sets the Member Object related to this Borrow Object.
*
* @param member
* The Member Object you wish to assign to this Borrow Object
*/
public void setMember(Member member) {
this.member = member;
}
/**
* Gets the Book Object related to this Borrow Object.
*
* @return book
*/
public Book getBook() {
return book;
}
/**
* Sets the Book Object related to this Borrow Object.
*
* @param book
* The Book Object you wish to assign to this Borrow Object
*/
public void setBook(Book book) {
this.book = book;
}
/**
* Gets the date representing the date a book was borrowed in this Borrow Object.
*
* @return The Date Borrowed
*/
public Date getDateBorrowed() {
return dateBorrowed;
}
/**
* Sets the date representing the date a book was borrowed in this Borrow Object.
*
* @param dateBorrowed
* The Date Borrowed you wish to assign to this Borrow Object
*/
public void setDateBorrowed(Date dateBorrowed) {
this.dateBorrowed = dateBorrowed;
}
/**
* Gets the date representing the date a book was returned in this Borrow Object.
*
* @return The Date Returned
*
*/
public Date getDateReturned() {
return dateReturned;
}
/**
* Sets the date representing the date a book was Returned in this Borrow Object.
*
* @param dateReturned
* The Date Returned you wish to assign to this Borrow Object
*/
public void setDateReturned(Date dateReturned) {
this.dateReturned = dateReturned;
}
/**
* A generic toString() method
*/
public String toString() {
return "" + borrowId + " " + member.getMemberId() + " " + book.getBookId() + " " + dateBorrowed + " " + dateReturned;
}
}