-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBook.java
More file actions
53 lines (49 loc) · 1.45 KB
/
Copy pathBook.java
File metadata and controls
53 lines (49 loc) · 1.45 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
public class Book {
final private String ISBN;
final private String title;
final private String author;
private String genre;
final private Integer publicationYear;
private boolean isAvailable;
Book(String ISBN, String title, String author, int publicationYear, String genre){
this.ISBN = ISBN;
this.title = title;
this.author = author;
this.genre = genre;
this.publicationYear = publicationYear;
this.isAvailable = true; //a new book is available
}
public String getISBN(){
return this.ISBN;
}
public String getTitle(){
return this.title;
}
public String getAuthor(){
return this.author;
}
public String getGenre(){
return this.genre;
}
public int getPublicationYear(){
return this.publicationYear;
}
public boolean isAvailable(){
return this.isAvailable;
}
public void setAvailability(boolean availability){
this.isAvailable = availability;
}
public String getBookInfo() {
return "ISBN: " + this.ISBN + "\nTitle: " + this.title + "\nAuthor: " + this.author + "\nGenre: " + this.genre + "\nYear: " + this.publicationYear + "\nAvailable: " + this.isAvailable;
}
public void setGenre(String genre){
this.genre = genre;
}
public void borrowed(){
this.isAvailable = false;
}
public void returned(){
this.isAvailable = true;
}
}