Enhancing the library!
1) Enhance the library with an ArrayList...
We saw the pain of using arrays when we need dynamic structures... Redo the methods of the receptionist and the client to show the books with a list! hint: ArrayList< Book > books = new ArrayList<>(); Check the available methods pressing Ctrl + space after writing "books".
2) Now you know Enums!
Books should have fixed values for their state... A char is not a good choice for these situations since they can have 65,535 values! We just need 3: <b>AVAILABLE</b>, ORDERED, UNAVAILABLE In the last assignment the receptionist had the following method: - requestBooksList() Make sure you only print the Books with "AVAILABLE" state. If you need, create books with different states, UNAVAILABLE and ORDERED.
3) After entering the library, depending on the choice... The receptionist, a client or the manager can do different things right?
You implemented the following behaviours for the receptionist: - 1) startShift() - 2) stopShift() - 3) showAvailableBooks() Let the user choose what the receptionist should do creating a submenu!
4) After requesting the list of available books, the client chooses one book!
Implement the following behaviours for the client: - requestAvailableBooksList() - takeBook() Make sure you change the book state to UNAVAILABLE! Like you did with the receptionist, create a submenu with the respective number options.
5) Everybody can leave the library right?
Use inheritance and implement the following method: - leave() An option must be available to the client, the receptionist and the manager! After choosing the option "leave()" the program must go back to the initial state asking to choose one initial option.
6) If the receptionist leaves, she/he must also stop their shift!
Modify the receptionist leave() method to also stop the shift!