This C++ project simulates a basic Library Management System that allows book management, member registration, and operations such as borrowing and returning books. It supports detailed constraints and edge case handling, making it robust for realistic scenarios.
-
Attributes
title(public): Title of the book.author(public): Author of the book.isbn(private): Unique book identifier.copiesAvailable(private): Available copies.totalCopies(private): Total number of copies.
-
Constructors
- Parameterized constructor.
- Constructor with default values (
"UnknownTitle","UnknownAuthor","ISBN",0,5). - Copy constructor with new ISBN.
-
Methods
- Getters for
isbn,copiesAvailable,totalCopies. updateCopies(count): Adjusts book count (rejects negative totals).borrowBook(): DecreasescopiesAvailableif possible.returnBook(): IncreasescopiesAvailableif not exceedingtotalCopies.printDetails(): Prints book's title and author.
- Getters for
-
Constraints
- Unique ISBN enforced.
copiesAvailablemust remain between0andtotalCopies.
-
Attributes
memberID(private): Unique member identifier.name(public): Member name.borrowedBooks(private): Map of ISBN to quantity borrowed.borrowLimit(private): Maximum borrowable books (default = 3).
-
Constructors
- Parameterized constructor.
- Constructor with default
borrowLimit.
-
Methods
borrowBook(isbn): Borrows book if limit not exceeded.returnBook(isbn): Returns book if borrowed.printDetails(): Prints member info and borrowed books.
-
Constraints
- Can borrow same book multiple times (up to availability).
- Cannot exceed
borrowLimitor 15 total borrowed books.
-
Attributes
books(private): Vector of all books.members(private): Vector of all members.
-
Methods
addBook(Book&): Adds new book (enforces unique ISBN).registerMember(Member&): Registers new member (enforces unique ID).borrowBook(memberID, isbn): Validates and processes borrowing.returnBook(memberID, isbn): Validates and processes returning.printLibraryDetails(): Prints book and member details.
-
Constraints
- Max 50 books, 150 members.
- Each book: Max 15 copies.
- Each member: Max 15 borrowed books.