In this task, you are to enhance a basic library management system in Kotlin by implementing several functions in the LibraryService class.
This system allows for adding books to a library and searching them by title, author, or genre.
The LibraryService class already contains skeleton methods that you need to fill in.
Additionally, you are provided with two data classes: Book and Author. A Book has a title, a list of authors, a publication year, a genre, and an ISBN number. An Author has a name.
Your task includes:
- Create an
Authorclass with a single fieldnameof type String - Create a
Bookclass with the following fields. Please put them in the order as described below:titleof typeStringauthorsof typeList<Author>publicationYearof typeIntgenreof typeStringisbnof typeString
- Implementing the
addBook(book: Book)method to add a new book to the library. HINT: use some collection here. Book duplicates are allowed. - Implementing the
searchByTitle(title: String): List<Book>method to return a list of books that contain the given title. The search should be case-insensitive. - Implementing the
searchByAuthor(authorName: String): List<Book>method to return a list of books written by authors whose names contain the given string. This search should also be case-insensitive. - Implementing the
searchByGenre(genre: String): List<Book>method to return a list of books that match the given genre exactly, with case-insensitivity.