In: Computer Science
NOTE: This assignment is for
the design only
Nothing you turn in should look like C/C++ code
For this assignment, we are going to design a system to Manage
loans from the local public library
For this, we will need the following
entities, plus collections for each of the
entities: Patrons, Books, and Loans
The data for a Book will contain at
least the following:
Author
Title
ISBN Number
Library ID number
Cost
Current Status (In, Out, Repair, Lost)
You may add other data needed for your implementation as well as you will need accessor and mutator functions for the data.
The data for a Patron will contain at least:
Name (e.g. Fred Smith)
ID number (6 digits e.g. 123456)
Fine Balance
Current # of books out
You may add other data needed for your implementation as well as
you will need accessor and mutator functions for the data.
The data for a Loan (The transaction entity) will contain at least
the following:
Loan ID
Book ID
Patron ID
Due Date and Time
Current Status (overdue, normal)
You may add other data needed for
your implementation as well as you will need accessor and mutator
functions for the data.
For the collections of each of the Patrons and Books Classes
identified above, you will need to include the ability to:
Add
Edit
delete
Search/Find based on appropriate criteria
Print a list of all entries in the collection
Print the details for a single entity (do a find first)
Other methods you may identify
For Loans you will need:
Check Out a book (update book and
patron info as well as add a loan)
Check in a book (check for fines and update patron and book info
and delete loan)
List all overdue
List all books for a particular patron
Update loan status based on the system clock
Re-Check a book
Edit a loan
Report lost (update book and charge patron book cost as well)
Other methods you may identify
You will need to verify the following
You will need to provide an appropriate menu system that can be multi-level if you like.
Do not attempt to provide card catalog services for allowing patrons to search for books. You may assume each book has a unique acquisition number, and you may use these numbers to refer to books borrowed and returned.
You will need to load and store the data. This can be done automatically when the program starts and ends. You should also want to store after an add, delete or edit to make sure changes to the data are preserved.
You can assume the following
Loan period is 10 days with an additional recheck of 10 days (1 recheck only)
A max of 6 books can be out to a single patron at a time
Fine rate is $0.25 per day (24 hour period)
For this design you will need to turn in the following:
A diagram set consisting of:
All of these items should be gathered together, in order, in a single PDF file.
NOTE: This assignment is for
the design only
Nothing you turn in should look like C/C++ code
SINGLE CLASS DIAGRAM SHOWING RELATION BETWEEN THE ENTITIES.
SET OF INDIVIDUAL CLASS DIAGRAM.
Pseudo code for Add_book
1. get library id number for the book.
2. Insert into table_books
values(Book_ID,author,title,ISBN_number,Library_ID_number,Cost,current_status)
3. Response - Book successfully added.
Pseudo code for Edit_book
1. Update into table_books
values(author,title,ISBN_number,Library_ID_number,Cost,current_status)
where Book_ID = "+id+"
2. Response - Book updated successfully.
Pseudo code for Delete_book
1. delete from table_books where Book_ID = "+id+"
2. Response = Book deleted successfully.
Pseudo code for search_for_books
1. select from table_books where Book_ID = "+id+"
2. Response = Book fetched successfully.
Pseudo code for get_all_books
1. select * from table_books;
2. Response = All books fetched successfully
Pseudo code for get_book_info
1. select from table_books
values(author,title,ISBN_number,Library_ID_number,Cost,current_status)
where Book_ID = "+id+"
2. data = database_query_result
3. response - data, Book information fetched successfully.
Pseudo code for Add_patron
1. Insert into table_patrons
values(Patron_Id,Name,ID_Number,Fine_balance,borrowed_books)
2. Response - Patron successfully added.
Pseudo code for Edit_book
1. Update into table_patrons
values(Patron_Id,Name,ID_Number,Fine_balance,borrowed_books) where
Patron_ID = "+id+"
2. Response - Patron updated successfully.
Pseudo code for Delete_patron
1. delete from table_patrons where Patron_ID = "+id+"
2. Response = Patron deleted successfully.
Pseudo code for search_for_patrons
1. select from table_patrons where Patron_ID = "+id+"
2. Response = Patron fetched successfully.
Pseudo code for get_all_patrons
1. select * from table_patrons;
2. Response = All patrons fetched successfully
Pseudo code for get_patron_info
1. select from table_patrons
values(Patron_Id,Name,ID_Number,Fine_balance,borrowed_books) where
Patron_ID = "+id+"
2. data = database_query_result
3. response - data, Book information fetched successfully.
Pseudo code for checkout_book
1. before checkout check borrowed_books <= 6 and Patron_ID
not in list_of_overdue_books.
2. add Book_ID,Patron_ID to the table_loans.
3. add Loan_ID into table_loans.
4. change current_status for Book_ID to borrowed.
Pseudo code for checkin_book
1. before check_in check fine_balance for Patron_ID = 0
2. change current_status for Book_ID to not_borrowed.
Pseudo code for list_of_overdue_books
1. left_join table_books and table_loans on borrowed_books and
overdue_datetime.
2. select borrowed_books from tbl_books where overdue_datetime >
10.
3. left_join table_patrons and table_books on Patron_ID and
Book_ID
4. select Patron_ID from tbl_patrons where Book_ID = "+id+".
Pseudo code for report_lost_book
1. set report_lost_book field in loans to true.
2. for Patron_ID in table_patrons set book_lost_patron =
true.
3. for Book_ID in table_books set book_is_lost = true.
4. for Patron_ID in table_patrons set fine_balance =
new_fine_balance.
5. for Patron_ID in table_patrons set fine_paid = true.
Paragraph for design experience.
The library loan design is a system which requires managed databases and admin system to keep track of the books, patrons and loans.
The entities were easy to design but to establish the relation between those entities was the tricky part. I had to also keep in mind the constraints such as fine and overdue datatime and lost books and had to update all the other tables when an event such as this occurred.
But I had a great experience in designing these system and gave my best efforts to make the design optimal.