#C13590. Dynamic Library Management System
Dynamic Library Management System
Dynamic Library Management System
Design and implement a dynamic library management system to process various operations such as adding books, registering members, issuing and returning books, calculating fines, searching for books, and listing overdue loans.
The system must handle commands read from standard input and produce outputs as specified. Commands include operations for adding books, registering members, issuing and returning books, calculating fines between two dates (in \(\LaTeX\) format, the fine is calculated as \(\max(\text{days}\! -\!14, 0)\) multiplied by a fixed fine per day), searching books, listing overdue loans based on a provided current date, and setting a custom issue date for simulation.
inputFormat
The first line contains an integer T indicating the number of commands. Each of the following T lines represents a command. Each command has one of the following formats:
• ADD title author isbn genre copies • REGISTER name member_id contact member_type • ISSUE isbn member_id • RETURN isbn member_id • CALCFINE return_date issue_date (Dates are given in YYYY-MM-DD format. The fine is computed as (\max((\text{return_date} - \text{issue_date} - 14),0)) since a borrowing period of 14 days is allowed.) • SEARCH search_key search_value • OVERDUE current_date (Lists all overdue loans where the difference between current_date and the issue date exceeds 14 days. For each overdue loan, output: "isbn member_id member_name fine".) • SETISSUEDATE isbn member_id date (Manually set the issue date for a loan to simulate overdue conditions.)
Commands are processed sequentially. For the commands that produce an output, your program should print the result on a new line.
outputFormat
For each command that requires an output, print the result on a separate line. The expected outputs are as follows:
• ISSUE: Print "Issued" if the operation is successful; if not, print the error message (e.g., "Invalid member ID" or "Book not available"). • RETURN: Print "Returned" if the operation is successful; otherwise, print the error message. • CALCFINE: Print the calculated fine as an integer. • SEARCH: Print the count of books matching the search criteria. • OVERDUE: If there are overdue loans, first print the number of overdue items, then for each overdue loan, print a line in the format "isbn member_id member_name fine". If there are no overdue loans, print 0.## sample
6
REGISTER MemberA 1 1234567890 student
ADD BookA AuthorA 12345 Fiction 3
ISSUE 12345 1
SEARCH title BookA
RETURN 12345 1
CALCFINE 2023-10-20 2023-10-01
Issued
3
Returned
5
</p>