write the java mini project and upload the code .class as like this and also provide the screenshot of the code. use these method for insert ,remove and search public boolean insertBook(Book b) { for(int i=0; i
write the java mini project and upload the code .class as like this and also provide the screenshot of the code.
use these method for insert ,remove and search
public boolean insertBook(Book b) {
for(int i=0; i<books.length; i++) {
if(books[i] == null) {
books[i] = b;
return true;
}
}
return false;
}
public boolean removeBook(Book b) {
for(int i=0; i<books.length; i++) {
if(books[i].getIsbn().equalsIgnoreCase(b.getIsbn())) {
for(int j=i; j<books.length-1; j++) {
books[j] = books[j+1];
}
return true;
}
}
return false;
}
public Book searchBook(String isbn) {
for(int i=0; i<books.length; i++)
{
if(books[i] != null)
{
if(books[i].getIsbn().equals(isbn))
{
return books[i];
}
}
}
return null;
}
public void showAllBooks() {
for(int i=0; i<books.length; i++) {
if(books[i] != null)
{
books[i].showDetails();
}
}
}
Step by step
Solved in 5 steps with 2 images