Feedback for these lessons is very much welcome. If you like or hate something about a lesson let us know, either on GitHub, via Mail or just tell us in person ;)
x
B09 - Advancing the Library
Lets add some useful functionality to our library project1. The tests 2 for this exercise will help you work out the correct implementation. Use them!
What’s to do
- Add (readonly) static limit
MAX_MEDIA_COUNT
toUserAccount
to express that a user can only borrow 10 items - Add
Borrow
andReturnMedia
methods toUserAccount
(return bool) ReturnMedia
should also update the Fees- You can only return what you have borrowed.
- You can only borrow if
MAX_MEDIA_COUNT
is not reached - Add a property
BorrowedCount
toUserAccount
that gives the curred number of borrowed items of this account - Add
Borrow
andReturnMe
methods toMedium
that marks/unmarks the borrower (UserAccount
) and sets the returnDate/calculates the fees if late - Add a method
Authentificate
toLibrary
to identify a user. It shall take an long id and return aUserAccount
object or null if this id is not connect to any account