The main entities will be –
Each user can have multiple book and each book can be subscribed to multiple user. Library maintains a list of all books.
Each User will have few functions – addMemberShip(), renewMemberShip(), cancelMemberShip(), accessSubscribedBook(), readBook()
This can actually be split into two parts – One class for creating Book as an entity as it can be either a magazine, audio book, ebook etc. This will allow creation and deletion and addToLibrary() and removeFromLibrary() function.
Book can be an abstract class (which can implement an interface as well ?? ).
Each Book will have few basic functions – bookDetails(), bookSubscribed(), bookDetails()
Other classes that extend it will be Magazine, Ebook, AudioBook, Manual etc.
Used for searching book mainly.
For maintaining a relationship b/w book and users we will have to maintains the data in DB. like,
book -> user ( bookid, uid, subscribeDate, unsubDate)
user -> book ( bookid, uid, subscribeDate, unsubDate)
We can have a single table whee bookid and uid will be indexed.
In a DS we can use a hash map.