Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Your task is to implement a Catalog ofBooks. 1. For thisfirst you have to implem

ID: 3609979 • Letter: Y

Question

Your task is to implement a Catalog ofBooks.

1.      For thisfirst you have to implement Book class The Book class is a simpleclass to store information about a particular book and it has thefollowing data members:

Write default and parameterizedconstructors and setters getters for the Book class.

2.      Catalogclass is a linked list of Book objects and that can perform thefollowing functionality.

o       Add methodto add a book in the Catalog

o      PrintAllBooks method to print all the books in theCatalog.

o      SearchByAuthor method will take author name as anargument and will find a book written by that author.

o       Availablemethod to print all those books that are currently available. Ifthe status of a book is false than it means that book is notavailable, if the status is true then it means book isavailable.

3.      Include amain function as follows:

Explanation / Answer

import java.io.*; import java.lang.*; import java.util.*; class Book { /* attributes */ private String title; private String author; private String ISBN; private boolean status; /*constructors */ public Book(){ this.title="" ; this.author ="" ; this.ISBN ="" ; this.status =false ; } public Book(String title, String author, String ISBN, booleanstatus){ this.title=title ; this.author =author ; this.ISBN =ISBN ; this.status =true ; } /** set and get methods */ public String getTitle(){ return this.title ; } public void setTitle(String title){ this.title = title ; } public String getAuthor(){ return this.author ; } public void setAuthor(String author ){ this.author =author ; } public String getISBN(){ return this.ISBN ; } public void setISBN(String ISBN){ this.ISBN =ISBN ; } public boolean getStatus(){ return this.status ; } public void setStatus(boolean status ){ this.status = status; } } //end of book class public class Catalog {    public static LinkedListlibrary;    public Catalog(){        library   = newLinkedList();    }    public void add(Book book){    library.add(book);    }    public void printAllBooks(){    for (Book b : library)       System.out.println("Title: " +b.getTitle() +" Author: "+b.getAuthor()+"  ISBN: " +b.getISBN()+"   status: "+b.getStatus());    }    public void searchByAuthor(String author){    for (Book b : library)    {        if(author.equals (b.getAuthor()))        {          System.out.println("Title: " + b.getTitle() +" Author: "+b.getAuthor()+"   ISBN: "+b.getISBN()+"   status: "+b.getStatus());           return;         }    }    System.out.println("the book written by "+author + " is not there in tha catalog");    }    public void available(){     for (Book b : library)     {     if(b.getStatus()){       System.out.println("Title: " +b.getTitle() +" Author: "+b.getAuthor()+"  ISBN: " +b.getISBN()+"   status: "+b.getStatus());       }    }    }     public static void main(String[] args){        Book b1 = new Book("Introduction to c++","cohoon" , "12345-AD" , true);     Book b2 = new Book("Introduction to algorithms","cormon" , "1dfsd45-AD" , true);     Book b3 = new Book("Introduction to java","david" , "123sfsdfds23435D" , true);     Book b4 = new Book("Harry Potter", "J.K.Rowling" , "56565-JKR" , true);     Book b5 = new Book("The TIme Machine", "Wells" ,"13456-TM" , true);     b3.setStatus(false);        Catalog c = new Catalog();     c.add(b1); c.add(b2); c.add(b3); c.add(b4);c.add(b5);     System.out.println("printing All Books");     c.printAllBooks();     System.out.println();        System.out.println("Searching Book written ByWells");     c.searchByAuthor("Wells");     System.out.println();        System.out.println("Printing the availableBooks");     c.available();     System.out.println();        }    }