-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathItem.java
More file actions
197 lines (152 loc) · 4.09 KB
/
Item.java
File metadata and controls
197 lines (152 loc) · 4.09 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
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
package src.anearcan;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.Date;
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
/**
*
* @author anearcan
*/
public class Item implements Comparable<Item>, Comparator<Item> {
/*******************
* PROPERTIES
*******************/
private String title; // the name of the Item
private String genre; // the genre of the movie/videogame
protected int numTimesChecked; // the number of times the movie was checked out
private int productID;
private boolean isReserved;
private boolean overDue;
private Date dateReturned;
private Date dateRented;
private int noOfCopies;
private int rentalPrice;
private int purchasePrice;
private String description;
private ArrayList<MemberAccount> membersReserving;
protected Date releaseDate; // The date the Item was released
/*******************
* CONSTRUCTOR(S)
*******************/
public Item() {
}
public Item(int id, String title, String genre, Date releaseDate) {
productID = id;
this.title = title;
this.genre = genre;
this.releaseDate = releaseDate;
}
public Item(int id, String title, int rentPrice, int purchasePrice) {
productID = id;
this.title = title;
rentalPrice = rentPrice;
this.purchasePrice = purchasePrice;
}
public Item(String title, int rentPrice, int purchasePrice) {
this.title = title;
rentalPrice = rentPrice;
this.purchasePrice = purchasePrice;
}
public Item(int id, String title, int rentPrice, int purchasePrice, int quantity) {
productID = id;
this.title = title;
rentalPrice = rentPrice;
this.purchasePrice = purchasePrice;
noOfCopies = quantity;
}
// Implementing Comparable:
// Comparisons based on title
public int compareTo(Item item) {
return title.compareTo(item.getTitle());
}
/*******************
* Get/set Methods
*******************/
public Date getReleaseDate() {
return releaseDate;
}
public void setReleaseDate(Date releaseDate) {
this.releaseDate = releaseDate;
}
public void setRentalPrice(int rentalPrice){
this.rentalPrice = rentalPrice;
}
public int getRentalPrice(){
return rentalPrice;
}
public void setPurchasePrice(int purchasePrice){
this.purchasePrice = purchasePrice;
}
public int getPurchasePrice(){
return purchasePrice;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getGenre() {
return genre;
}
public void setGenre(String genre) {
this.genre = genre;
}
// toString()
public String toString() {
return title + ",Genre: " + genre + ",Rating: " + ",Times Checked Out: " + this.numTimesChecked
+ ",Release Date: " + this.releaseDate;
}
public int getProductID() {
return productID;
}
public void setProductID(int id) {
productID = id;
}
public boolean getIsReserved() {
return isReserved;
}
public boolean getIsReserved(boolean reserved) {
return isReserved;
}
public void setOverDue(boolean overDue) {
this.overDue = overDue;
}
public boolean isOverDue() {
return overDue;
}
public void setDateReturned(Date dateReturned) {
this.dateReturned = dateReturned;
}
public Date getDateReturned() {
return dateReturned;
}
public void setDateRented(Date dateRented) {
this.dateRented = dateRented;
}
public Date getDateRented() {
return dateRented;
}
@Override
public int compare(Item t, Item t1) {
throw new UnsupportedOperationException("Not supported yet.");
}
public ArrayList<MemberAccount> getWaitingList() {
return membersReserving;
}
public int getNoOfCopies() {
return noOfCopies;
}
public void setNoOfCopies(int number){
noOfCopies = number;
}
public void setDescription(String text){
description = text;
}
public String getDescription(){
return description;
}
}