2025-03-22 23:52:51 +03:00
|
|
|
|
package classesTemplate;
|
|
|
|
|
|
|
|
|
|
public class Book {
|
|
|
|
|
private String title;
|
|
|
|
|
private String author;
|
|
|
|
|
private int isbn;
|
2025-03-27 15:27:38 +03:00
|
|
|
|
private boolean isAvailable = true;
|
2025-03-22 23:52:51 +03:00
|
|
|
|
|
2025-03-27 15:27:38 +03:00
|
|
|
|
public Member borrowedMember;
|
|
|
|
|
|
|
|
|
|
public String getTitle() {
|
|
|
|
|
return title;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void setTitle(String title) {
|
|
|
|
|
this.title = title;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public String getAuthor() {
|
|
|
|
|
return author;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void setAuthor(String author) {
|
|
|
|
|
this.author = author;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public int getIsbn() {
|
|
|
|
|
return isbn;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void setIsbn(int isbn) {
|
|
|
|
|
this.isbn = isbn;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Member getBorrowedMember() {
|
|
|
|
|
return borrowedMember;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void setBorrowedMember(Member borrowedMember) {
|
|
|
|
|
this.borrowedMember = borrowedMember;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Book(String title, String author, int isbn) {
|
2025-03-22 23:52:51 +03:00
|
|
|
|
this.author = author;
|
2025-03-27 15:27:38 +03:00
|
|
|
|
|
2025-03-22 23:52:51 +03:00
|
|
|
|
this.isbn = isbn;
|
|
|
|
|
this.title = title;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void displayInfo() {
|
|
|
|
|
System.out.println("Kitap ismi=" + title + "\nYazar=" + author + "\nISBN=" + isbn);
|
2025-03-27 15:27:38 +03:00
|
|
|
|
if (isAvailable) {
|
|
|
|
|
|
|
|
|
|
System.out.println("Kitap ödünç alınabilir.");
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
|
|
System.out.println(borrowedMember.getName() + " kitabı almış!");
|
|
|
|
|
|
|
|
|
|
}
|
2025-03-22 23:52:51 +03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
2025-03-27 15:27:38 +03:00
|
|
|
|
public boolean borrowBook() {
|
2025-03-22 23:52:51 +03:00
|
|
|
|
if (isAvailable) {
|
|
|
|
|
|
|
|
|
|
isAvailable = false;
|
2025-03-27 15:27:38 +03:00
|
|
|
|
return true;
|
2025-03-22 23:52:51 +03:00
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
|
|
System.out.println("Kitap daha önce ödünç verilmiş!");
|
2025-03-27 15:27:38 +03:00
|
|
|
|
return false;
|
2025-03-22 23:52:51 +03:00
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void returnBook() {
|
|
|
|
|
isAvailable = true;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|