Create your own library class with an internal collection of books.
- Books should have title, author and genre.
- Write a method to count the number of books in the library.
- Write a method to add a book to the library stock.
- Add a capacity to the library and write a method to check if stock is full before adding a book.
- Add a third class which interacts with the other two. E.g. you could add a
Borrower
with a method that takes aBook
and moves to theBorrower
's collection.
- The library wants to keep track of it's number of books by genre. Using a HashMap, store the genre of each book as the key - and a count of how many books of that genre as the value.