-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBook.java
50 lines (39 loc) · 1.06 KB
/
Book.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
public class Book {
// properties, fields, global variables
String title;
int pageCount;
int ISBN;
boolean isCheckedOut;
int dayCheckedOut = -1;
// constructor
public Book(String bookTtitle, int bookPageCount, int bookISBN) {
this.title = bookTtitle;
this.pageCount = pageCount;
this.ISBN = ISBN;
isCheckedOut = false;
}
// getters --> instance methods
public String getTitle(){
return this.title;
}
public int getPageCount() {
return this.pageCount;
}
public int getISBN() {
return this.ISBN;
}
public boolean getIsCheckedOut() {
return this.isCheckedOut;
}
public int getDayCheckedOut() {
return this.dayCheckedOut;
}
// setters
public void setIsCheckedOut(boolean newIsCheckedOut, int currentDayCheckedOut){
this.isCheckedOut = newIsCheckedOut;
setDayCheckedOut(currentDayCheckedOut);
}
private void setDayCheckedOut(int day){
this.dayCheckedOut = day;
}
}