-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBook.java
More file actions
29 lines (25 loc) · 977 Bytes
/
Book.java
File metadata and controls
29 lines (25 loc) · 977 Bytes
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
public class Book {
private String bookID;
private String title;
private String author;
private String isbn;
private boolean available;
public Book(String bookID, String title, String author, String isbn) {
this.bookID = bookID;
this.title = title;
this.author = author;
this.isbn = isbn;
this.available = true; // Initially, the book is available
}
// Getters and Setters
public String getBookID() { return bookID; }
public String getTitle() { return title; }
public String getAuthor() { return author; }
public String getIsbn() { return isbn; }
public boolean isAvailable() { return available; }
public void setAvailable(boolean available) { this.available = available; }
@Override
public String toString() {
return "Book ID: " + bookID + "\nTitle: " + title + "\nAuthor: " + author + "\nISBN: " + isbn + "\nAvailable: " + (available ? "Yes" : "No");
}
}