Library
Step-by-Step
-
Define a Book Case Class: Define a case class to represent a book with attributes like title, author, year of publication, and category.
-
Create a List of Books: Create an initial list of books.
-
Add a Book to the Library: Define a function to add a book to the library.
-
Search for Books by Title or Author: Define a function to search for books by title or author.
-
Filter Books by Category: Define a function to filter books by category.
-
Calculate Statistics: Define functions to calculate statistics like the total number of books and the average publication year.