u need to have a person class and library class
inheritance in member, Librarian from Person (member is-a person)
composition of book, member, librarian in Library (library has books, members and librarian)
Class Person:
Fields: Name, ID, Address, Email etc
Methods: Related To Fields
Class Member: Person
Fields: Username, Password, Borrowed[], ReturnedBooks[], Receipt, BorrowingLimitation, IsDefaulter
Methods: Related to Fields, but u should add Login Method to Library
Class Librarian: Person
Fields: Username, password, Rank
Methods: Add book, delete book, update book
(since in true OOP, Librarian doesn't have any info of book, so it will cal methods of books class to set their properties, fields accordingly)
Class Book
Fields: ID, name, author, edition, publisher, InStock(total no of books), Issued(total no of Issued Books), rack no
Methods: IssueBook, ReturnBook, EditBook
Class Library
Fields: Name, Address, TelePhone, Books[], Members[], Librarians[]
Methods: AddMemebr, RomoveMemebr, . . .. . AddBook, RemoveBook
Hope u get it.
Khan, do you mean the book class inherit Member & Librarian? IMO, The Librarian & Member class should inherit books so that you can access the book properties that the Liberian has added, modified or deleted and you can access the the books that each members have access to. This seems like a 'crappy' method, but I think it produce the desired results.
Updated 21-Aug-11 3:24am
v2
Hi, I think it's always valuable to think in terms of 'is-a', 'has-a' and 'contains' relationships.
A Librarian is-a Person; a Member is-a Person.
A Library contains a collection of Books, Librarian(s), Members.
'Book' is your 'atomic element' here.
A Member has-a collection of books: the ones they've checked out.
A Librarian's has-a collections of books may be several : books just returned, and not yet put back on the shelves, books ordered, books overdue for return.
Your methods seem right.