CO252: Computer Programming and Networking
LAB 05: Object Oriented Programming
Objective: Introduce you to the idea of Classes and Objects in Java; their variables and how they can be
used to model problems.
Lab Task: Develop a Library management system that consists of Library, Book, Borrower and Staff
classes. Book class should have an id (id should be unique to each and every book and it should be
automatically assigned to each Book object when created), title, ISBN number, whether the book is
available or not and author. Borrower class should have borrower name, name of the borrowed book,
date of issue, due date and the number of books borrowed. Staff class should contain a member name, a
staff title.
Create two constructors for the Book class. First constructor should be the default constructor, You
should create an object and assign values to the attributes of that object. Second constructor should pass
the values as arguments to the constructor. Create the objects in the Library class.
Create a method in the book class to check whether a book is available or not. If the book is not available
it should print sorry the book Mechanics (the name of the book) is not available. Else it should print The
book Mechanics is available under the ID 35(id of the book).
Create suitable methods for borrowing and returning the books in the Book class. Note that when a book
is borrowed and returned availability should be changed.
Note that submissions which are copied from internet or other sources will be given zero
marks
Submission : Submit the .java files to the submission link on or before the deadline. Late
submissions are not accepted.