-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLibraryBook.java
More file actions
50 lines (42 loc) · 1.24 KB
/
Copy pathLibraryBook.java
File metadata and controls
50 lines (42 loc) · 1.24 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
public class LibraryBook {
private int id;
private String section;
private String bookTitle;
private String bookAuthor;
private boolean isBorrowed;
public LibraryBook(int id, String title, String author, String section) {
this.id = id;
this.bookTitle = title;
this.bookAuthor = author;
this.section = section;
this.isBorrowed = false; // A new book is always available
}
//Methods to get book details
public int getId() {
return id;
}
public String getSection() {
return section;
}
public String getBookTitle() {
return bookTitle;
}
public String getBookAuthor() {
return bookAuthor;
}
public boolean isBorrowed() {
return isBorrowed;
}
//methods to set book details
public void setBorrowed(boolean borrowed) {
isBorrowed = borrowed;
}
// Method to return a string representation of the book
public String toString() {
return "ID: " + id +
", Title: '" + bookTitle + '\'' +
", Author: '" + bookAuthor + '\'' +
", Section: '" + section + '\'' +
", Status: " + (isBorrowed ? "Borrowed" : "Available");
}
}