Book
class tracks each book and borrowing days.Member
class exists but not used yet.Records
class handles record-keeping, including reading from a file, adding data, and displaying records.read_records
: Reads data from a file and populates book and member data.display_records
: Formats and prints data in a table with proper alignment.main
: InitializesRecords
object, reads, and displays based on file name.
- New attributes:
name
,book_type
,n_copy
,max_days
,late_charge
. - Methods for adding borrowed days and computing stats (borrowing members, reservations, range of borrowing days).
- Ensures textbooks (
book_type == 'T'
) have max 14 days borrowing. - Ensures fiction books (
book_type == 'F'
) have max >14 days borrowing. - Terminates with an error if conditions are not met.
- Methods to read and validate book data.
- Display detailed book info and save to a file.
- Prints detailed book info: ID, Name, Type, Copies, Max days, Late charge, Borrowing members, Reservations, Range of days.
- Writes book info to
reports.txt
in a specified format.
- Handles command-line arguments for record and book files.
- Displays record and book tables.
- Saves book data to
reports.txt
.
- New attributes:
first_name
,last_name
,dob
,member_type
. - Methods for adding borrowing details and computing stats (textbooks, fictions, borrowing limits, average days).
- Reads member data, associates borrowed books with members.
- Warns if member ID not found, adds borrowing details, maintains a dictionary for quick lookup.
- Handles three command-line arguments: record file, book file, member file.
- Reads and displays member data, saves to
reports.txt
.
- Enhanced
Member
class for managing data. - Restructured
Records
class for book-member associations. - Improved validation in
read_books
. - Updated display methods for new attributes.
- Enhanced
save_books_to_file
. - Customized main function for three arguments.
DI level adds complexity in managing book-member relationships and validation, providing a robust system for record-keeping and reporting.
- Introduced exceptions:
FileNotFound
,EmptyFile
,InvalidRecordFormat
,InvalidBookID
,InvalidMemberID
.
- Added
fee
attribute for overdue charges. - Enhanced
add_borrowing
method for fee calculation.
- Split book/member info into tables (Textbooks, Fictions, Standard, Premium Members).
- Enhanced file reading with exceptions.
- Modified display methods for new table structures.
- Enhanced
save_books_to_file
with timestamps.
- Separate tables for Textbooks, Fictions, Standard, Premium Members.
- Sorted alphabetically by book name and by fee for members.
- Handles three command-line arguments, added error messages for file issues.
- Custom exceptions for robustness.
- Fee attribute for overdue charges.
- Split tables for readability.
- Ensured correct sorting and formatting.
- Added timestamps to report files.
HD level improves error handling, data categorization, and reporting, ensuring robust and user-friendly program.