This repository continues the development of a Library Management System using JavaScript. In this version, you'll extend the basic system by adding functionalities for borrowing and returning books.
-
Extend the
Book
Class:- Add a parameterized constructor to initialize the book’s
title
,author
,year
,borrower
, andisBorrowed
properties when creating a new book object. - Add two new methods:
borrowBook(borrowerName)
: Handles the borrowing process. Checks if the book is already borrowed. If not, it assigns theborrower
and marks the book as borrowed.returnBook()
: Handles returning a borrowed book. Ensures the book can only be returned if it has been borrowed in the first place.
- Add a parameterized constructor to initialize the book’s
-
Update the
Library
Class:- Make sure the
Library
class interacts with the new borrow and return methods.
- Make sure the
- Set Book Properties: Set title, author, and year using the constructor when creating a book.
- Borrowing Books: Check if a book can be borrowed and mark it as borrowed if available.
- Returning Books: Check if a book is borrowed before returning it to the library.
-
Fork the Repository: Click the "Fork" button at the top right corner of this page.
-
Clone Your Fork:
git clone https://github.com/<yourusername>/Library-Management-System.git
-
Open the Code: Use your favorite code editor to start coding.
-
Extend the
Book
Class:- Define properties for
title
,author
,year
,borrower
, andisBorrowed
. - Implement methods to handle book borrowing and returning functionality.
- Define properties for
-
Modify the
Library
Class:- Ensure the library can add books and handle borrowing/returning books through interaction with the
Book
class.
- Ensure the library can add books and handle borrowing/returning books through interaction with the
Good Luck!